导入excel数据,类型问题
excel文件中数据:
account subject
51050104012 1
51050104013 1
51050104014 2
51050104015 2
...
数据库 account_test 表结构:
id int
account varchar(20)
subjectId int
使用以下语句导入excel中的数据:
insert into account_test(account,subjectid)
select account,subject
from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source="D:\student.xls";Extended properties=Excel 5.0')...Sheet1$
则account字段的值均为:5.10501e+010,使用如下类型转换也没用:
insert into account_test(account,subjectid)
select convert(varchar(20),account),subject
from opendatasource('Microsoft.Jet.OLEDB.4.0','Data Source="D:\student.xls";Extended properties=Excel 5.0')...Sheet1$
如何解决?