日期:2014-05-17  浏览次数:20405 次

sql 可以导入远程计算机的excel表吗
我每段时间都要 sql server 2005中导入excel表中的数据,每次都是从我自己的电脑上用飞秋传到数据库服务器上,放到指定盘里用下面的语句导入
insert into t_bos_transbill
SELECT a.*,getdate() FROM 
OpenDataSource('Microsoft.Ace.OLEDB.12.0','Data Source="e:\\test1.xlsx";Extended properties="Excel 12.0;HDR=Yes"')...[Sheet1$] a;
 有没有办法在已知我电脑IP地址,用户名,密码的情况先直接连到我自己的电脑上导入数据,省得每次传文件麻烦
谢谢
SQL

------解决方案--------------------
try this,

insert into t_bos_transbill
SELECT a.*,getdate() FROM 
OpenDataSource('Microsoft.Ace.OLEDB.12.0','Data Source="\\\\192.168.123.1\\001\\44.xlsx";Extended properties="Excel 12.0;HDR=Yes"')...[Sheet1$] a;