Files
GateDge2023_ljy/01.扩展/HandleUtils/sql/将excel表格查询出来.sql
PastSaid fa480006a8 1
2024-07-16 10:33:50 +08:00

21 lines
808 B
Transact-SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--1.开启Ad Hoc Distributed Queries组件在sql查询编辑器中执行如下语句
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
declare @path varchar(1000)
set @path = 'C:\Users\Fareoh\Downloads\aa.xlsx'
--SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;HDR=Yes;IMEX=2;DATABASE=C:\Users\Fareoh\Downloads\aa.xlsx',[Sheet1$])
SELECT *
INTO 税收分类编码导入EXCEL
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;HDR=Yes;IMEX=2;DATABASE=C:\Users\Fareoh\Downloads\aa2.xlsx','SELECT * FROM [Sheet1$]')
--2.关闭Ad Hoc Distributed Queries组件在sql查询编辑器中执行如下语句
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
SELECT * FROM 税收分类编码导入EXCEL