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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bulk Import w/Format File and Text Fields - Why is it not working?

Status
Not open for further replies.

BradF

Programmer
Mar 29, 2005
28
US
Here's what my data looks like:

Code:
"12312331        ","DOE, JOHN","3423423",0,1900-01-01 
00:00:00,"","@@ 
","","JOHN DOE PROCESSING PLANT"


Here's my format file:

Code:
7.0 
10 
1       SQLCHAR 0       0       "\""             0       "" 
2       SQLCHAR 0       250     "\",\""             1       "c1" 
3       SQLCHAR 0       250     "\",\""             2       "c2" 
4       SQLCHAR 0       250     "\","            3       "c3" 
5       SQLCHAR 0       250     ","           4       "c4" 
6       SQLCHAR 0       250     ",\""            5       "c5" 
7       SQLCHAR 0       250     "\",\""             6       "c6" 
8       SQLCHAR 0       250     "\",\""             7       "c7" 
9       SQLCHAR 0       250     "\",\""             8       "c8" 
10      SQLCHAR 0       250     "\"\r\n"         9       "c9"

I even tried changing it into the simplist form possible because I kept getting an error...

Code:
7.0 
9 
1       SQLCHAR 0       250     ","           1       "c1" 
2       SQLCHAR 0       250     ","           2       "c2" 
3       SQLCHAR 0       250     ","           3       "c3" 
4       SQLCHAR 0       250     ","           4       "c4" 
5       SQLCHAR 0       250     ","           5       "c5" 
6       SQLCHAR 0       250     ","           6       "c6" 
7       SQLCHAR 0       250     ","           7       "c7" 
8       SQLCHAR 0       250     ","           8       "c8" 
9       SQLCHAR 0       250     "\"\r\n"      9       "c9"

Which should just remove the last quote in the final field. No matter
what I try, I get the same error each time:


Could not bulk insert. Invalid column number in format file 'D:\UPSDATA
\DBUS1000\LeadImprovement\FORMAT3.fmt'.


However this works:

Code:
7.0 
9 
1       SQLCHAR 0       250     ","           1       "c1" 
2       SQLCHAR 0       250     ","           2       "c2" 
3       SQLCHAR 0       250     ","           3       "c3" 
4       SQLCHAR 0       250     ","           4       "c4" 
5       SQLCHAR 0       250     ","           5       "c5" 
6       SQLCHAR 0       250     ","           6       "c6" 
7       SQLCHAR 0       250     ","           7       "c7" 
8       SQLCHAR 0       250     ","           8       "c8" 
9       SQLCHAR 0       250     "\r\n"                9       "c9"

It seems it dislikes the escaped " as a field delimiter no matter what....


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top