I am getting an error when running an UPDATE statement:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
when I attempt to execute this SQL query:
Update tblCommunityServiceMembers
Set SeniorManagerFlag = 'Y'
Where EmployeeList =
(select distinct emp.EmployeeID, csm.CommunityServiceMembers,
csm.SeniorManagerFlag from dbo.tblEmployee emp,
dbo.CommunityServiceMembers csm
where charindex(emp.EmployeeID, > csm.CommunityServiceMembers,1) > 0)
The nested select query does return more than one record. So I want to update the flag value to Y for all those records. Any help is appreciated.
EmployeeList? 2. What does>mean incharindex(emp.EmployeeID, > csm.CommunityServiceMembers,1)? I first thought it was a typing error, but then I'm not pretending to know all aboutCHARINDEXusage. 3. And just to clarify it, what type isemp.EmployeeIDif it's notint?