SQL Server Performance

bcp file format....

Discussion in 'SQL Server 2005 General DBA Questions' started by cutiepie, Sep 20, 2005.

  1. cutiepie New Member

    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 "
    " 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: empinput.txt -fc: empformat.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....
  2. vbkenya New Member

    Your format file is not formatted correctly. The number of columns, the version and the delimiters are wrong.

    Use this:

    8.0
    2
    1 SQLCHAR 0 4 "," 1 numbers
    2 SQLCHAR 0 15 "
    " 2 values

    And you data file should be like this:

    1234,other
    5678,column







    Nathan H.Omukwenyi
  3. satya Moderator

    Have you checked SQL 2005 books online for formatfile option topic.

    Satya SKJ
    Moderator
    http://www.SQL-Server-Performance.Com/forum
    This posting is provided “AS IS” with no rights for the sake of knowledge sharing.

Share This Page