Format Files?

  • Hi every Body

    I'm trying to do a Bulk insert from a text file containing this kind of data:

    9|Certainesaaaaaaaaaaa|A00-B99

    9|Maladiesbbbbbbbbbbbb|A00-A09

    into a table having this structure:

    "GL_Id" int identity not null,

     "GL_Type" "smallint not null,

     "GL_Label" " varchar(8) l" null,

     "GL_Code" " varchar(254)" null,

    as you see I don't include the ID of the table in the file, so i wan't use the KEEPIDENTITY option, and I'm using this Format file with 0 values and no Terminator for the ID column to skip the importing of the ID column, so the system can use the identity increment (DBCC..):

    8.0

    1    SQLCHAR    0    0     ""       1    GL_ID  SQL_Latin1_General_Cp437_Bin

    2    SQLCHAR    0    7    "|"      2     GL_Type  SQL_Latin1_General_Cp437_Bin

    3    SQLCHAR    0    64    "|"     3    GL_Label SQL_Latin1_General_Cp437_Bin

    4    SQLCHAR    0    16    "\n"    4    GL_Code  SQL_Latin1_General_Cp437_Bin

    But then the sytem brings this error (sorry for thr french version):

    Serveur : Msg 4882, Niveau 16, État 1, Ligne 8

    Insertion en bloc impossible. Longueur de préfixe, longueur ou fin de champ requises pour la colonne source 1 dans le fichier de format 'c:\GlFormat.fmt'.

    thank you for any help, or example of a correct format file

    Cheers

     

     

      

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply