Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BULK INSERT not same no columns in each line.

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK
Hi

How can I BULK INSERT from a file that does not have the same number of columns (fields) in each line?
Say my file looks like

------------------------------------------
a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a
b,,,b
c,c,,,,,c,,,,,,,,,,
------------------------------------------
I've tried
------------------------------------------
BULK INSERT #Mytable FROM 'Myfile' WITH (FIRSTROW=1,FIELDTERMINATOR = ',',ROWTERMINATOR = '\n')
------------------------------------------
But that does not work (the lines are mixed up as if the ROWTERMINATOR statement was ignored).

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top