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