您的位置:首页 > 产品设计 > UI/UE

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

2014-03-01 15:59 603 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: