Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2012-03-29
2
794 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

861 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