Help Please!What is missing from this updat script?
USE [Staples POG Test] GO UPDATE Plano SET Desc3 = (SELECT message_line_6 FROM Spaceman.dbo.NSW WHERE Id = Name UPDATE Plano SET Desc4 = (SELECT segment_width/width FROM Spaceman.dbo.SECTION WHERE Id = Name UPDATE Plano SET Desc5 = (SELECT height FROM Spaceman.dbo.SECTION WHERE Id = Name UPDATE Plano SET Custom1 = (SELECT depth FROM Spaceman.dbo.SECTION WHERE Id = Name UPDATE Plano SET Custom2 = (SELECT width FROM Spaceman.dbo.SECTION WHERE Id = Name UPDATE Plano SET Custom3 = (SELECT segment_width FROM Spaceman.dbo.SECTION WHERE Id = Name
Assuming you are using "column" and "table" keywords for brevity and mistakenly posted the script more than once, there is a closing parentheses ")" missing after the "Name" Column. Also are you sure that ID & Name have the same data type and are the intended columns to compare the values? Moreover, what error you are prompted with? EDIT: After re-formatting the question I realize that the OP wants to update multiple columns @callvey You can certainly update multiple columns in one update statement like UPDATE tableA SET ColumnA = [column], ColumnB = [column], ColumnC = [column], ColumnD = [column], ColumnE = [column], ColumnF = [column] FROM tableA INNER JOIN DB2.dbo.[TABLE] ON ID = NAME EDIT1: According to the latest information UPDATE Plano SET Desc3 = message_line_6 FROM Plano INNER JOIN Spaceman.dbo.NSW ON ID = NAME UPDATE Plano SET Desc4 = segment_width/width, Desc5 = height , Custom1 = depth , Custom2 = width , Custom3 = segment_width FROM Plano INNER JOIN Spaceman.dbo.SECTION ON ID = NAME