I am trying and getting an error.
SELECT COUNT (*) FROM case @ Type 'username' then user where user name = @name; When 'UserGroup' is the group where GroupName = @GroupName and GroupType = 'USERGROUP' END I know that you usually use the case after the '=' symbol. .. but is there any way I am trying here?
SQL Server 2008
You either have to type dynamic SQL and execute it, or if we have an IF statement and two Ask the question ...
IF (@type = 'UserName') from user SELECT COUNT (*) where user name = @name ELSE if group (@ type = usergroup ') group Select (*) where groupname = @ group name and group type = 'USERGROUP'
Comments
Post a Comment