I need to take data from one table and import it into another table. In the pseudo code, something like this:
For Each row in table1 If row.personid is in table2 then update table2.row Else insert row into table2 End If Next
What is the best way to do this in T-SQL? As far as I understand, T-SQL does not support For Every..Next, so what are my alternatives?
sql foreach sql-server tsql
davemackey
source share