SQLTeam.com | Weblogs | Forums

Stored procedure with inner join


is it possible to use the following update command in a stored procedure to get more speed? Now the command is given in the front-end client but takes some time .

The command is :slight_smile:
UPDATE Tbl_Portfolio INNER JOIN TBL_NWA_Proj ON Tbl_Portfolio.Proj_account = TBL_NWA_Proj.Account SET Tbl_Portfolio.[NWA created] = True;

So when the two fields match in the two tables one field is set to true.

Thanks in advance.


UPDATE T_P --<<-- you MUST use an alias to be safe when UPDATEing using a JOIN 
SET [NWA created] = True
FROM Tbl_Portfolio AS T_P
INNER JOIN TBL_NWA_Proj T_N_P ON T_P.Proj_account = T_N_P.Account;