Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Using CASE Statements Expand / Collapse
Author
Message
Posted Friday, May 16, 2014 5:38 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 11:45 AM
Points: 317, Visits: 823
A typical update using a IF could look like

IF (month(getdate())=4)
begin
update t1
set t1.columnA=t2.columnA
from table1 as t1 inner join table2 as t2
ON t1.someOtherColumn=t2.someOtherColumn
END
ELSE
begin
--- do something else
end




See if this helps you get started
Post #1571955
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse