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 ...
Get Inside Microsoft® SQL Server™ 2005: T-SQL Querying now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.