Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rcr69er
Constraint Violating Yak Guru
327 Posts |
Posted - 2008-09-18 : 12:33:09
|
| Hi GuysIS it possible to use a CASE statement in an UPDATE statement?i'm using the following query but it doesnt seem to work, any ideas?UPDATE [TMP.PUDImport]SET [Flag] = (CASE [Flag] WHEN [ForDeletion] = 0 THEN 1 WHEN [ForDeletion] = -1 THEN 2 END)Any ideas?Thanks |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-09-18 : 12:37:11
|
| Where is "Where Clause"? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-18 : 12:38:24
|
quote: Originally posted by rcr69er Hi GuysIS it possible to use a CASE statement in an UPDATE statement?i'm using the following query but it doesnt seem to work, any ideas?UPDATE [TMP.PUDImport]SET [Flag] = (CASE [Flag] WHEN [ForDeletion] = 0 THEN 1 WHEN [ForDeletion] = -1 THEN 2 END)Any ideas?Thanks
no need of column name after CASE |
 |
|
|
|
|
|