开发者

First Row As Column Header in OPENROWSET

select * from OpenRowset('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)}; 
DefaultDir=C:\;
Extended properties=''ColNameHeader=True;
Format=Delimited(\tab);''',
'select * from MyFile.txt')

The issue is, the first row from the file becomes the header of the table.

What should I add/modify so that the first row from the file will not be the header?

ColNameHeader=False --> will not solve the开发者_StackOverflow中文版 problem.

Thanks.


SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\; Extended Properties="Text;HDR=No;FMT=Delimited"')...[FILE#txt]

This one solves the problem :D


You'll need to use a schema.ini file, which should reside in the same directory as the file you're reading: http://msdn.microsoft.com/en-us/library/windows/desktop/ms709353(v=vs.85).aspx

That will allow you to specify your column names.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜