数据库高手近!从Excel给sql server 2005导入数据问题:

2024-11-06 12:46:22
推荐回答(2个)
回答(1):

insert into dbo.Monit_Node1(ThroCapacity,NetDelay,CPU_OccupRate,ChannCapacity,TrafDropped)
SELECT ThroCapacity,NetDelay,CPU_OccupRate,ChannCapacity,TrafDropped
FROM OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source=d:\shuju.xls;Extended Properties=EXCEL 8.0' )...[Sheet1$] Rowset_1

回答(2):

最后一个参数需要加单引号,加上就好了
insert into dbo.Monit_Node1(ThroCapacity,NetDelay,CPU_OccupRate,ChannCapacity,TrafDropped)
select ThroCapacity,NetDelay,CPU_OccupRate,ChannCapacity,TrafDropped from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 5.0;database=d:\shuju.xls;','select * from [sheet1$]');