You see things; and you say 'Why?' But I dream things that never were; and I say 'Why not?'

Monday, February 9, 2009

Doing a bulk insert of a text file in temp table

SELECT BulkColumn
FROM OPENROWSET (BULK '\\servername.path\test\flatfile.txt',
SINGLE_CLOB)
MyFile

When used with the BULK provider keyword you can name a data file to read as one of three types of objects:

SINGLE_BLOB, which reads a file as varbinary(max)
SINGLE_CLOB, which reads a file as varchar(max)
SINGLE_NCLOB, which reads a file as nvarchar(max)

No comments:

Followers