将Excel导入SQL Server2000
select * into tableName from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source=e:\simple.xls;Extended Properties=Excel 8.0')[sheet1$]
select * into tableName from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=e:\simple.xls',[sheet1$])
select * into tableName from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=e:\simple.xls','select * from [sheet1$])
注意:Excel表最好有列标题,否则导入时易造成第1行数据(都是数值时)丢失
导入后的数据类型都是varchar(255)
select * into tableName from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source=e:\simple.xls;Extended Properties=Excel 8.0')[sheet1$]
select * into tableName from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=e:\simple.xls',[sheet1$])
select * into tableName from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=e:\simple.xls','select * from [sheet1$])
注意:Excel表最好有列标题,否则导入时易造成第1行数据(都是数值时)丢失
导入后的数据类型都是varchar(255)