RSS Links

 

Here are all of the RSS links for sections of this site

VB.NET/ASP.NET
 Java
 Unix/Linux
 Windows
 SQL Server

Home arrow SQL Server arrow Inserting data from one table into another in SQLServer
Inserting data from one table into another in SQLServer PDF Print E-mail
Thursday, 27 November 2008
There are two basic methods

One is to use an INSERT INTO which can be used where the table is already created

INSERT INTO TestTable (FirstName, LastName)
SELECT FirstName, LastName
FROM Person.Contact
WHERE EmailPromotion = 2

The second is to use a SELECT INTO which can be used to also auto create the table

SELECT FirstName, LastName
INTO TestTable
FROM Person.Contact
WHERE EmailPromotion = 2

Thanks to pinaldave for this tips - the fuller explaination can be found at http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/

Last Updated ( Wednesday, 31 December 2008 )
 
< Prev   Next >
 
Designed by Graham Robinson Software