cheryl9063
asked on
What is wrong with this Case statement?
I have function that will return an integer however I need to do some set up before hand.. I'm trying to populate a table variable based on if the paramater passed into the function(@loginID) is null or not.. My Case and my else is being highlighted as invalid syntax.. What is it?
Declare @UserGroup table(UserGroupID int)
CASE
WHEN @LoginID is not null
THEN
Insert into @UserGroup
Select UserGroupID from UserGroup_login
Where LoginID = 103
ELSE
Insert into @UserGroup
Select UserGroupID from UserGroup_login
Where UserGroupID = @UserGroupID
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window