x

How to handle SQL Server BCP bulk insert if extra fields come in data file than we defined in format file

I am using non-xml format file to perform bulk import from a data file. Format File:

 12.0
 4
 1       SQLCHAR       0       7       "\t"     1     DepartmentID     ""
 2       SQLCHAR       0       100     "\t"     2     Name             ""
 3       SQLCHAR       0       100     "\t"     3     GroupName        ""
 4       SQLCHAR       0       24      "\r\n"   4     ModifiedDate     ""

If I have defined number of fields 4 in format file and I am getting 4 fields and sometimes more than 4 fields in data file. How to handle this situation dynamically from failure.I don't want to make any changes in format file manually.

more ▼

asked Apr 18, 2016 at 09:31 AM in Default

avatar image

sunny_jais
1 1

(comments are locked)
10|1200 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x428
x72
x57
x44

asked: Apr 18, 2016 at 09:31 AM

Seen: 103 times

Last Updated: Apr 18, 2016 at 09:31 AM

Copyright 2018 Redgate Software. Privacy Policy