SNilsson
asked on
Case statement T-SQL syntax
This works:
SET @X = Case @Y
WHEN 1 THEN 444
WHEN 2 THEN 555
END
How can I make this work:
Case @Y
WHEN 1 THEN
SET @X = 444
SET @Z = 222
WHEN 2 THEN
SET @X = 555
SET @Z = 333
END
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SNilsson,
50/50 I guess, either way you have 14 sets to do, probably the IFs would be easier to read and maintain.
Tim.
50/50 I guess, either way you have 14 sets to do, probably the IFs would be easier to read and maintain.
Tim.
ASKER
Okey, in that case what would be the most efficient, using several If statement or two case statements (Y can hold 7 different valuse so it would be 7 IF's) ?