2012年3月8日星期四

bcp file format...its killing me...pleaseeeeeeeee help...

Hi,
i wanted to ask on the same context of bcp...i m trying to insert two rows into a table using the bcp command prompt and the bcp file looks as follow(format.fmt):
7.0
3
1 SQLCHAR 0 4 "\"," 1 numbers
2 SQLCHAR 0 15 "\"" 2 values
3 SQLCHAR 0 2 "\r\n" 3 finish

and the input file has the following contents
1234,"other"
5678,"column"

now when i m running the command as
bcp master.dbo.two_column in c:\temp\input.txt -fc:\temp\format.fmt -Sserver -Uuser -Ppasword -T

it gives me the error as sqlstate 07009 with native state =0 and the error as = [Microsoft][SQL Native Client] Invalid descriptor index

i m using sql server 2005 (YUKON)...can anyone pleaseeeeeeeeeeeeee tell me how can i solve this problem???????so that i can insert these rows into my table two_column...
thanks ...pleaseeeeeeeeee help me...First off, line one should not be 7.0 for 2005.

For SQL 2k it.s8.0

I guess 2005, it should be 9.0, but I don't know that for sure.

Did you get the 2005 BOL Beta as well?|||Just curious, but what's the DDL for creating your table? I suspect it only has two columns.

-PatP|||Thanks for your replies...but now...i have changed the version of format file as follow...n yeah i have 2columns only:
9.0
2
1 SQLCHAR 0 4 "," 1 in_numbers SQL_Latin1_General_CP1_CI_AS
2 SQLCHAR 0 5 "\r\n" 2 values SQL_Latin1_General_CP1_CI_AS

and the input file is
1234,other
5678,column

but now its givin me the error as I\O error while reading BCP format file...

it was workin for sometime..it copied these two rows as well...but again its givin me this error again n again...i cant understand...wat m i suppose to do now...PLEASEEEEE TRY TO HELPPPP
thnks in advance|||Can you post the exact error ?|||hi,
the error was just that I\O error while reading the BCP file format...but now finally its over since i had to press enter twice...after the last row in the format file...just some empty rows in the format files had solved my problem
thnks.

没有评论:

发表评论