using tsql, sqlserver 2005.
I would like insert records from table table2 into an existing table table1 as easily as I could enter it into a new table table1 using:
select facilabbr, unitname, sortnum into table1 from table2
Any ideas?
using tsql, sqlserver 2005.
I would like insert records from table table2 into an existing table table1 as easily as I could enter it into a new table table1 using:
select facilabbr, unitname, sortnum into table1 from table2
Any ideas?
Assuming you just want to append and that the columns match up:
INSERT INTO Table1
SELECT facilabbr, unitname, sortnum FROM table2
If you want to replace and the columns still match:
Truncate Table1
INSERT INTO Table1
SELECT facilabbr, unitname, sortnum FROM table2
If you want to replace and the columns do not match:
DROP Table1
SELECT facilabbr, unitname, sortnum INTO Table1 FROM table2
INSERT INTO TABLE1 T1 (T1.FIELD1, T1.FIELD2) SELECT (T2.FIELD1, T2.FIELD2) FROM TABLE2 T2 should work.