Solved

Loading data via BCP when there are missing columns in text file

Posted on 2012-03-29
2
734 Views
Last Modified: 2012-04-10
Hi,
I have number of tables with NULL column values allowed within them.

I have data files which I need to import into these tables using BCP. As expected, BCP needs matching columns with text data and surely not the case here.

I can see suggestion of using format file but it's not working for me.

I don't want to hand edit tonnes of files.I need to know if there is an easy way to create format files  using  BCP switches or any other alternative?

Thanks
0
Comment
Question by:crazywolf2010
2 Comments
 
LVL 24

Accepted Solution

by:
DBAduck - Ben Miller earned 500 total points
ID: 37785451
You should look at the format file for bcp.

http://msdn.microsoft.com/en-us/library/ms191479.aspx

Look at the section that tells you about column order.  You can map the field 4 in the file to field 6 in the table.

And here is the reference for skipping the field in the table with the format file.

http://msdn.microsoft.com/en-us/library/ms179250.aspx
0
 

Author Comment

by:crazywolf2010
ID: 37786282
Hi,
Do I have to hand code each of the fmt file?


Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now