Update Command with CASE Statement Archives - Tech Insights https://reactconf.org/category/update-command-with-case-statement/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Sun, 20 Apr 2014 16:31:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 Update Command with CASE Statement Archives - Tech Insights https://reactconf.org/category/update-command-with-case-statement/ 32 32 230003556 Update Command with CASE Statement https://reactconf.org/update-command-with-case-statement/ https://reactconf.org/update-command-with-case-statement/#respond Sun, 20 Apr 2014 16:31:00 +0000 http://www.sqlneed.com/2014/04/20/update-command-with-case-statement/ Advanced SQL – Conditionally Updating Update Command MS SQL Server UPDATE Emp    SET  incentive = CASE                     WHEN  salary >=1500 and salary <5000 THEN                          3000                     WHENsalary> 5000 …

The post Update Command with CASE Statement appeared first on Tech Insights.

]]>

Advanced SQL – Conditionally Updating Update Command
MS SQL Server
UPDATE Emp
   SET  incentive = CASE
                    WHEN  salary >=1500 and salary <5000 THEN
                         3000
                    WHENsalary> 5000 andsalary<10000 THEN
                       CASE
                          WHEN firstname in (‘AJAY’) THEN
                         5000
                   END
                   ELSE  incentive
                 END;
 SELECT * FROM EMP;
Output

Conditionally Updating Data From Another Table
UPDATE  EMPdetail SET Grad = (SELECT
CASE   WHEN salary >=1500 and salary <5000 THEN
 ‘B’
WHEN salary>5000 and salary<10000 THEN
              CASE
                 
WHEN firstname in (‘AJAY’) THEN
                               ‘A’
                   END
                   ELSE
 Grad
                 END)

The post Update Command with CASE Statement appeared first on Tech Insights.

]]>
https://reactconf.org/update-command-with-case-statement/feed/ 0 2219