Invalid Descriptor Index Error when Using BCP with SQL Server
Home > ASP > Invalid Descriptor Index
I was trying to use BCP to import a lot of data into Sql Server. I thought
I had my formatfile set up correctly. I was using these commands:
"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\sqlcmd"
-S .\SQLEXPRESS -i sql_delete_product.txt
"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\bcp" teem.dbo.product
in product.txt -E -T -S .\SQLEXPRESS -U john -f product_bcp.txt -e errors.txt
The first command deletes everything in the table "product", and
the second imports all the information from a text file into that table. The
error I got (from running the bcp command) really means "You
have the same column name in your file twice, you idiot." Once I made sure
that the formatfile only had the column "overview" mentioned once,
it worked. Here is the (correct) bcp format file:
9.0
10
1 SQLCHAR 0 4 "|" 1 id ""
2 SQLCHAR 0 50 "|" 2 name Latin1_General_CI_AS
3 SQLCHAR 0 50 "|" 3 alpha_sort Latin1_General_CI_AS
4 SQLCHAR 0 2 "|" 4 importance ""
5 SQLCHAR 0 0 "|" 5 description Latin1_General_CI_AS
6 SQLCHAR 0 0 "|" 6 overview Latin1_General_CI_AS
7 SQLCHAR 0 1 "|" 7 category ""
8 SQLCHAR 0 4 "|" 8 subcategory ""
9 SQLCHAR 0 3 "|" 9 rid Latin1_General_CI_AS
10 SQLBIT 0 1 "\r\n" 10 active ""
Page updated 6 Nov 2006
|