[SQL] Copy Database one table to another database

Source: Internet
Author: User
Tags sql server books syslog

SQL: Copy Database one table to another database in SELECT* into table 1 from table 2--Copy Table 2 If you copy only the structure without copying the content or just a column, just add the Where condition. Example: SELECT*into [imcdb]. [dbo]. [SysLog] from [Aimmanagedb]. [dbo]. [Syslog] (copy syslog tables from database aimmanagedb to database imcdb) replicate tables across serversSelect* into [SMSDB]. [dbo]. [SysLog] From OPENROWSET ('SQLOLEDB', ' Target server ';'Account Number';'Password', [Smsdb]. [dbo]. [SysLog]) (Copy the Syslog table from the database target server to the local database smsdb) eg: if the following error occurs: (SQL Server blocked the component'Ad Hoc Distributed Queries'The STATEMENT'Openrowset/opendatasource'access, because this component has been shut down as part of this server's security configuration. System administrators can enable by using sp_configure'Ad Hoc Distributed Queries'。 About enabling'Ad Hoc Distributed Queries'For more information, see the SQL Server Books Online"Perimeter Application Configurator". WORKAROUND: Enable ad Hoc distributed queries:exec sp_configure'Show advanced Options',1Reconfigure exec sp_configure'Ad Hoc Distributed Queries',1reconfigure close the ad HOC distributed queries:exec after use is complete sp_configure'Ad Hoc Distributed Queries',0Reconfigure exec sp_configure'Show advanced Options',0Reconfigure --8- -Other Import MethodsSelect* fromtable1 into table2 table2 must not exist insert into table2Select* fromTable1 table2 must exist

[SQL] Copy Database one table to another database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.