Friday, May 04, 2007 7:40 PM
royashbrook
SQL native stack joins on text files
snipped from here.
Openrowset now allows the BULK clause to be specified which accepts
a filename and format specification. An OLE-DB driver for flat-files or
XML would also do the job but this is a nice work-around for the native
stack. The only difficulty is getting your head around the format for
the .fmt file but after that it 'just works':
select *
from openrowset(bulk N'c:\temp\test.txt', formatfile = 'c:\temp\test.fmt') as x
see this previous post about bulk importing and format files etc.
Filed under: sql, Tips-n-Tricks