O'Reilly logo

Inside Microsoft® SQL Server™ 2005: T-SQL Querying by Dejan Sarka, Lubor Kollar, Itzik Ben-Gan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inserting Data

In this section, I’ll cover several subjects related to inserting data, including: SELECT INTO, INSERT EXEC, inserting new rows, INSERT with OUTPUT, and sequence mechanisms.

SELECT INTO

SELECT INTO is a statement that creates a new table containing the result set of a query, instead of returning the result set to the caller. For example, the following statement creates a temporary table called #MyShippers and populates it with all rows from the Shippers table in the Northwind database:

SELECT ShipperID, CompanyName, Phone
INTO #MyShippers
FROM Northwind.dbo.Shippers;

SELECT INTO is a BULK operation. (See the "Other Performance Considerations" section at the end of the chapter for details.) Therefore, when the database recovery model ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required