If-then in SQL Server

I need to make a command on SQL Server, which should basically say

If table1.columnx = 1 then update table2 set comumnx = 1 

It should be very simple, but I cannot come up with a solution.

+4
source share
1 answer
 update t2 set columnx = 1 from table1 t1 inner join table2 t2 on t1.id = t2.id where t1.columnx = 1 
+11
source

All Articles