I am trying to insert data from one of my existing table into another existing table.
Is it possible to insert data into any existing table using select * into
No, you cannot use SELECT INTO
to insert data into an existing table.
The documentation makes this very clear:
SELECT…INTO creates a new table in the default filegroup and inserts the resulting rows from the query into it.
You generally want to avoid using SELECT INTO
in production because it gives you very little control over how the table is created, and can lead to all sorts of nasty locking and other performance problems. You should create schemas explicitly and use INSERT
- even for temporary tables.
Update from CTE? http://www.sqlservercentral.com/Forums/Topic629743-338-1.aspx
You should try
INSERT INTO ExistingTable (Columns,..)
SELECT Columns,...
FROM OtherTable
Have a look at INSERT
and SQL SERVER – Insert Data From One Table to Another Table – INSERT INTO SELECT – SELECT INTO TABLE
@Ryan Chase Can you do this by selecting all columns using *? Yes!
INSERT INTO yourtable2
SELECT * FROM yourtable1