Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Bulk Load a file in a table

Author  Topic 

Prac
Starting Member

1 Post

Posted - 2014-10-30 : 16:28:51
Hi,

I have a file which has * as the field delimiter and ~ as the record delimiter, but I don't know how much columns each row will have. Only known is the maximum which can be 15.

The file looks something like
A1*A2*A3*~B1*B2~C1*C2*C3*C4*C5~

SO I have created a table with 15 columns(since 15 can be the max) but now when I try to insert it to that table, I inserts only the entire file into 1 single column.

The command which I am using is
BULK INSERT tablename FROM filename WITH (FIELDTERMINATOR = '*' , ROWTERMINATOR = '~')


but this is not giving the correct output.

The output expected is
A1 A2 A3
B1 B2
C1 C2 C3 C4 C5

Please help!

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-31 : 08:35:19
What is the output you ARE getting?
Go to Top of Page
   

- Advertisement -