Execl data import SQL Server, execl data import SQL

Source: Internet
Author: User

Execl data import SQL Server, execl data import SQL

You can import execl table data to the database to specify columns or *
Note:This statement can only be executed in the local database. If the remote server is connected, the statement should be executed on the server.

Set server global configuration to enable Ad Hoc Distributed Queries
This component has security risks, so it is disabled by default.

Exec sp_configure 'show advanced options', 1 reconfigureexec sp_configure 'ad Hoc Distributed Queries ', 1 reconfigure

You can import specified columns in the execl table to specified columns in the specified table.

Insert into Table Name (field name) select field name (corresponding to above) from OpenDataSource ('Microsoft. ace. OLEDB.12.0 ', 'Data Source = "c: \ document name .xls"; Extended properties = "Excel 12.0; HDR = Yes "')... [Document Table Name $] go

Set global server configuration to disable Ad Hoc Distributed Queries

Exec sp_configure 'ad Hoc Distributed Queries ', 0 reconfigureexec sp_configure 'show advanced options', 0 reconfigure

Related Article

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.