Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
CMiner
Starting Member
1 Post |
Posted - 2008-01-22 : 13:08:36
|
I'm using SSIS to do bulk inserts from fixed width files to about 20 tables in my SQL database.The problem I'm running into is in creating Format Files for the bulk insert task to use. I've gotten the bcp command to create format files that will read csv files, but I can't seem to figure out how to get it to create one for fixed-width.I know it can be done: http://msdn2.microsoft.com/en-us/library/ms191234.aspxAt the bottom (Section F) it shows an XML format file for reading a fixed-width file. When I manually create one of these to match one of my tables, the bulk insert worked fine.Closest I've come is with this ( [] bracketed items are correct values, just censored here):C:\Program Files\Microsoft SQL Server\90\Tools\Binn>bcp [database].[owner].[table] format nul -c -f C:\TableFMT.xml -x -S[Server] -U[Username] -P[Password]My question is, what is the bcp command to create this sort of XML format file? |
|
tm
Posting Yak Master
160 Posts |
Posted - 2008-01-28 : 17:06:49
|
Have you tried using -n instead of -c?C:\Program Files\Microsoft SQL Server\90\Tools\Binn>bcp [database].[owner].[table] formatnul -n -f C:\TableFMT.xml -x -S[Server] -U[Username] -P[Password] |
 |
|
|
|
|