Are these statements valid?
UPDATE Table1
FROM (SELECT * FROM Table2)
INSERT INTO Table1
(SELECT * FROM Table2)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your update statement needs a Set for each field you want to update, so no.
Correct syntax:
Your insert statement will work provided that Table1 and Table2 have the same columns in the same order.
Edit: If you’re looking for an example of Update/Insert (Upsert), check out this blog post (which works on SQL 2008–not sure about 2005 but doubt it).
Another option is an Update and then an insert. Example from this blog post :