I have this example insert statement that used to work for copying matching rows from Table2 to Table1:
INSERT INTO Table1 SELECT * FROM Table2 WHERE ID='555'
When this statement was working, both tables had the same three columns, FirstName, LastName, and EmailAddr1.
I've since added a column, EmailAddr2, to Table1 that doesn't appear in Table2 and I want to make sure that my modified insert statement will work as I expect.
Will this accomplish my goal?
SELECT @EmailAddr2 = '[email protected]'
INSERT INTO Table1 SELECT FirstName, LastName, EmailAddr1, @EmailAddr2
FROM Table2 WHERE ID='555'
insert into table" e.g. INSERT INTO table1(col1, col2, col3) SELECT col1, col2, col3 FROM table2