UPDATE Table1
SET Table1.Text = t2.DifferentText
FROM Table2 t2
WHERE Table1.Id = t2.Id;
Because I use multiple databases within the same database server, I'm always careful to be specific about the database and table names. So, for example, if you're updating Table1 on Database1 with data from Table2 on Database 2 your script will look like this:
UPDATE Database1.dbo.Table1
SET Table1.Text = t2.DifferentText
FROM Database2.dbo.Table2 t2
WHERE Table1.Id = t2.Id;
No comments:
Post a Comment