Thanks to the spirit of lee576, the Code is as follows: values (idINT, employeeVARCHAR (32) values (1, one) values (2, two) INSERTINTOtable1VALUES (3, three) INSERTINTOtable1VALUES (4, four) GOCREATE
Thanks to the spirit of lee576, the Code is as follows: USE tempdbgoCREATE TABLE table1 (id INT, employee VARCHAR (32) goINSERT INTO table1 VALUES (1, one) insert into table1 VALUES (2, two) insert into table1 VALUES (3, three) insert into table1 VALUES (4, four) GOCREATE
Thanks for the spirit of lee576, the Code is as follows:
USE tempdbgoCREATE TABLE table1 (id INT, employee VARCHAR (32) goINSERT INTO table1 VALUES (1, 'one') insert into table1 VALUES (2, 'two ') insert into table1 VALUES (3, 'three ') insert into table1 VALUES (4, 'four') gocreate table table2 (id int identity (), employee VARCHAR (32 )) GO -- ======================================================= -- use OUTPUT insert @ MyTableVar -- ================================== DECLARE @ MyTableVar TABLE (id INT) insert into table2 (employee) output inserted. id INTO @ MyTableVarSELECT employee FROM table1 -- ============================== = -- Query @ MyTableVar -- ==================================== SELECT * FROM @ MyTableVar -- drop table table1, table 2