Bulk Insert With Identity Field

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Nigel Rivett (sqlnr_at_hotmail.com)
Date: 09/20/04


Date: Mon, 20 Sep 2004 02:18:45 -0700

You can use a format file
see
http://www.nigelrivett.net/BCP_quoted_CSV_Format_file.html

But it's easier just to create a view which excludes those
columns and bcp into that.

>-----Original Message-----
>Hi All,
>
>Can I Bulk Insert to to SQL Table with a Identity Column
in it?
>
>My Source is a text file with 17 Columns and My Target is
a SQL Server table
>with 18 Columns (all 17 column of the source + 1 Identity
Column as Primary
>KEY).
>
>So In this Situation How can i Bulk Insert to the SQL
Table from the text
>file. Please give small example if possible.
>
>Also If my SQL table is have 2 More Extra Column Can I
Boul Insert from the
>above source?
>Ex: Total 19 Columns ( all 17 columns of the source text
file + 1 Identity
>Column + 1 Extra column). If I want to Insert into the 17
columns and I want
>the Indetity column to generate auto numbers and the Last
Extra Column to be
>Filled with Some "Char (1)" Value. Is that Possible?
>
>Thanks for any Help or suggestions
>Prabhat
>
>
>.
>



Relevant Pages

  • Re: Cannot fetch a row from OLE DB provider "BULK" for linked serv
    ... Bulk load: An unexpected end of file was encountered in the data file. ... Anyway, there was an error in the format file, at least in regards to ... This is probably when you need to look at SQL Server Integration Services, ...
    (microsoft.public.sqlserver.programming)
  • Re: can not bulk insert a network file onto a remote SQL server 2005
    ... SQL 2000 DTS can import the same file with no ... Bulk Insert task and when using the Import Column in a data flow task. ... There are clearly multiple people out here fighting it. ... > I get this error when run from Query analyser in remote machine ...
    (microsoft.public.sqlserver.dts)
  • Re: Bulk load data conversion error
    ... "rows" for BULK INSERT are not rows in a file. ... Of these five end with tab and the six with newline. ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)
  • Re: Use a sequence to bulk collect into a collection?
    ... Patrick Demets wrote: ... And this cursor returns one record. ... FETCH ew_eqmt_asgn_csr BULK COLLECT INTO ... SQL> create sequence testseq; ...
    (comp.databases.oracle.server)
  • Re: Bulk Insert permission
    ... "x" was a mapped drive but I have the same issue with a UNC path. ... My user is part of the Bulk Admin Role in SQL. ... This does sound like it is a permissions issue. ...
    (microsoft.public.sqlserver.programming)