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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Table Error

Author  Topic 

cableca
Starting Member

6 Posts

Posted - 2008-07-30 : 10:55:08
Hi,

Can someone let me know what's wrong with this syntax? I keep getting an error. Thank you!


Update reports.nraa SET act_type =
if ((ctype in ('0','7','I'), 1, if (ctype in ('A','L','O') , 2,3))

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-30 : 10:59:16
use CASE instead of if

Update reports.nraa 
SET act_type =
CASE WHEN ctype in ('0','7','I')
THEN 1
WHEN ctype in ('A','L','O')
THEN 2
ELSE 3
END
Go to Top of Page
   

- Advertisement -