August 3, 2011

INSERT all columns of a table into another table

If we want to insert record from another table we can write it in following ways.

INSERT INTO TABLE1
(Col1,Col2)
SELECT  Col1,Col2 FROM TABLE2


What if we want to insert all columns value

INSERT INTO TABLE1
SELECT  *  FROM TABLE2

But if we want to insert identity column value then we have explicitly mention all columns name.

No comments:

Post a Comment