0
点赞
收藏
分享

微信扫一扫

SQl 语句是Excel中的数据导入到SQL Service数据库中

1. //第一步:
2.
3. //启用Ad Hoc Distributed Queries:
4. exec sp_configure 'show advanced options',1
5. reconfigure
6. exec sp_configure 'Ad Hoc Distributed Queries',1
7. reconfigure
8. go
9.
10. //第二步:
11. SELECT * into dbo.tabel5
12. FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
13. 'Data Source="D:/book.xls";Extended properties=Excel 5.0')...[Sheet1$]
14. go
15.
16. //第三步:
17. //使用完成后,关闭Ad Hoc Distributed Queries:
18. exec sp_configure 'Ad Hoc Distributed Queries',0
19. reconfigure
20. exec sp_configure 'show advanced options',0
21. reconfigure
22. go
23.
24.

举报

相关推荐

0 条评论