June 20, 2011 at 12:58 am
I have a comma separated CSV file with double quotes ( " ) as my text qualifier.
I need to create a script to import this file into a table.
BULK INSERT does not work because it does not have a text qualifier indicator.
What are my options? How can I import this file using a script (it has to be scripted....) This has to be automated on a SQL express machine - there is not VS installation so i can not create a SSIS package.
June 20, 2011 at 6:54 am
Not sure you need VS installed to create an SSIS package. The SSIS Import / Export wizard could create the package for you. You would, however, need to have SSIS installed (and the service running) in order to run the package at need.
Have you looked at the BCP Utility? I don't use it, so I don't know if that will work for you or not.
June 20, 2011 at 8:00 am
BCP and BULK INSERT are virtually identical now-a-days. Neither will handle true CSV (with text qualifiers, etc) without a bit of work. If the text qualifiers are used consistently from row-to-row including the header of the file, it is possible to make a BCP Format File that will suss the problem.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 24, 2019 at 6:49 am
What worked for me was changing
ROWTERMINATOR = '\n'
to
ROWTERMINATOR = '0x0a'
in the BULK INSERT's WITH-statement .
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply