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 |
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-09-23 : 12:14:44
|
[code]TableA------SID syr sdt--- --- ----I need a help for update query with below conditionif the sdt <=2006 then SID=4 and syr=2006Else SID=5 and syr=2007 Thanks for your help in advance !![/code] |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-23 : 12:49:42
|
[code]UPDATE TableSET SID =CASE WHEN sdt<=2006 THEN 4 ELSE 5 END,syr=CASE WHEN sdt<=2006 THEN 2006 ELSE 2007 END[/code]I assume sdt is of integer datatype. |
 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-09-23 : 13:47:15
|
Thanks !! |
 |
|
|
|
|