question

sunny_jais avatar image
sunny_jais asked

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.
sql-server-2012import-databcpbulk-insert
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.