Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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 1WHEN ctype in ('A','L','O') THEN 2ELSE 3END