September 23, 2005 at 3:17 am
I have created a Select statement but it keeps failing with the following message:
"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
Can anyone suggest why I am getting this message?
Thanks
TSQL = SELECT @nBudgetUnit = (SELECT a.MEM_ID, b.MEM_NAME
FROM dbBudget.UNIT_TREE as a (NOLOCK)
INNER JOIN dbBudget.UNIT as b on a.MEM_ID = b.MEM_ID
WHERE MEM_NAME = @nSubName + ' ' + 'Budget')
September 23, 2005 at 3:45 am
Only one column can inserting to the variable.
TSQL = SELECT @nBudgetUnit = (SELECT a.MEM_ID FROM dbBudget.UNIT_TREE as a (NOLOCK)
INNER JOIN dbBudget.UNIT as b on a.MEM_ID = b.MEM_ID
WHERE MEM_NAME = @nSubName + ' ' + 'Budget')
September 23, 2005 at 3:50 am
Thank you, I'll give that a try right now.
September 23, 2005 at 11:39 am
Also, make sure that the sub-query returns only a single record since you are assigning it to a variable.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply