roy ashbrook

SQL native stack joins on text files

2007-05-04

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

← all writing