T-SQL For Each Alternative?
Posted
by davemackey
on Stack Overflow
See other posts from Stack Overflow
or by davemackey
Published on 2010-06-08T22:32:14Z
Indexed on
2010/06/08
22:42 UTC
Read the original article
Hit count: 292
I need to take data from one table and import it into another table. In pseudocode, 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 I understand it T-SQL doesn't support For Each..Next, so what alternatives do I have?
© Stack Overflow or respective owner