How to Quickly Create a Copy of a Table using Transact-SQL

The easiest way to create a copy of a table is to use a Transact-SQL command. Use SELECT INTO to extract all the rows from an existing table into the new table. The new table must not exist already. The following example will copy the Customers table under the Sales schema to a new table calledCurrCustomers under the BizDev schema:
SELECT * INTO BizDev.CurrCustomers FROM Sales.Customers

You can also create the new table from a specific subset of columns in the original table. In this case, you specify the names of the columns to copy after the SELECT keyword. Any columns not specified are excluded from the new table. The following example copies specific columns to a new table:
SELECT CustName, Address, Telephone, Email INTO BizDev.CurrCustomers
FROM Sales.Customers

原文: http://technet.microsoft.com/en-us/magazine/dd401720.aspx

How to Quickly Create a Copy of a Table using Transact-SQL,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。