csv:
select * from OpenRowset('MSDASQL','Driver={Microsoft Text Driver (*.txt; *.csv)};
DefaultDir=d:\;Extended properties=''ColNameHeader=True;Format=CSVDelimited;''','select * from sheet1.csv')
用系统的默认编码区匹配文件的编码,所以建议在使用前先用文本(notepad)把文件的编码转化为系统的编码ansi国内的。
xls:
Select * from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="D:\ODBC-DI\CR寄售销售订单明细表.xls";User ID=Admin;Password=;Extended properties=Excel 8.0')...[Sheet1$]
coming from: http://www.sqlservercentral.com/Forums/Topic268878-8-1.aspx