Hôm nay chúng tôi có thể giúp gì cho bạn?
How to Create a Copy of a SQL Table or Database
Issue
Often when troubleshooting and\or correcting data issues, it is desirable to work on a temporary or subset of the production data
to in order to test a solution or to focus on a small portion of some particular data item(s).
Product
Struxureware Power Monitoring
Power Monitoring Expert
ION Enterprise
ION EEM
Environment
SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014, SQL Server 2016, SQL Server 2017, SQL Server 2019, SQL Server 2022
Cause
Troubleshooting or correcting data issues.
Resolution
*Warning: Irreparable database damage can occur. This procedure should only be performed by users familiar with SQL Server Management Studio. Databases should be backed up prior to performing this procedure.*
An easy way to create a copy of a table is to use a SQL command.
Use SELECT INTO to extract all or a subset of the rows or from an existing table into the new table.
The new table must not exist already.
The following example will copy the Source table under the IonNetwork schema to a new table called MySource under the Test schema:
SELECT * INTO Test.MySource FROM IonNetwork.Source
You can also create the new table from a specific subset of rows in the original table.
In this case, you would append a Where clause to specify the criteria for only those rows you are interested in.
SELECT * INTO Test.MySource FROM IonNetwork.Source
Where Name like '%MySources%'
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 ID, Name, SourceTypeID, Description INTO Test.MySource
FROM IonNetwork.Source
Đã phát hành cho: Schneider Electric Việt Nam
Tìm hiểu thêm
Phạm vi:
Tìm hiểu thêm
Phạm vi:
Bạn cần trợ giúp?
Công cụ chọn sản phẩm
Nhanh chóng và dễ dàng tìm được sản phẩm và phụ kiện phù hợp cho các ứng dụng của bạn.
Nhận báo giá
Bắt đầu gửi yêu cầu bán hàng trực tuyến và chuyên gia sẽ liên hệ với bạn.
Nơi mua hàng?
Dễ dàng tìm nhà phân phối Schneider Electric gần bạn nhất.
Trung tâm Hỗ trợ
Tìm sự hỗ trợ cho mọi nhu cầu của bạn tại một nơi.