SQL statements for cross-server data import

Source: Internet
Author: User
Tags sql server books
SQL statements for cross-server data import

 

Cross-server data import SQL statements and solutions cross-server data import SQL statements:

-- Customize the table name. Create the table SELECT * INTO TbName from openrowset ('sqloledb', '123' before import. 168.0.7 '; 'sa'; 'damon king', DBName. dbo. tbName)

-- Cross-Server Query example SELECT * from openrowset ('sqloledb', '2017. 168.0.7 '; 'sa'; damon king', DBName. dbo. tbName) Press F5. If 'ad Hoc Distributed Queries 'is not enabled, the following message is displayed:

SQL Server blocks access to the STATEMENT 'openrowset/OpenDatasource 'of the 'ad Hoc Distributed Queries' component because this component has been disabled as part of the Server's security configuration. The system administrator can enable 'ad Hoc Distributed Queries 'by using sp_configure '. For more information about enabling 'ad Hoc Distributed querys', see "peripheral application configurator" in SQL Server books online ".

In this case, you can use sp_configure to enable 'ad Hoc Distributed Queries ':

-- Enable 'ad Hoc Distributed Queries'

EXEC SP_CONFIGURE 'show advanced options', 1 reconfigure exec SP_CONFIGURE 'ad Hoc Distributed Queries ', 1 RECONFIGURE

After the import is completed, it is best to disable 'ad Hoc Distributed Queries ': -- disable 'ad Hoc Distributed Queries'

 

EXEC SP_CONFIGURE 'ad Hoc Distributed Queries ', 0 reconfigure exec SP_CONFIGURE 'show advanced options', 0 RECONFIGURE

The cross-server data import task is completed!

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.