Hi, all here,
I am having a question about update several columns with CASE expression in SQL Server 2005 database engine. Is it possible to do that in SQL Server 2005 database engine?
Thanks a lot in advance for any help and guidance.
Can you be more specific about what you're trying to achieve? Using CASE in an update statement is perfectly legal. For instance you can set the value of a column based on a case statement:
declare @.var int
set @.var = 10
update T1 set Col1 = case @.var when 1 then 'Something' when 2 then 'Something2' else 'SomethingElse' end
where Col1 = 1
No comments:
Post a Comment