Friday, March 14, 2014

Use of CASE statement in UPDATE query

Use of CASE statement in UPDATE query:
update emp
set job = case when job = 'CLERK' then 1
                when job = 'SALESMAN' then 2
                when job = 'MANAGER' then 3
                when job = 'ANALYST' then 4
                when job = 'PRESIDENT' then 5 else 0 end;
(14 row(s) affected)


Similer post:
Cannot insert the value NULL into column '', table ' '; column does not allow nulls. UPDATE fails.

No comments:

Post a Comment

web stats