SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Inconsistent Bulk Insert
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

herbau
Starting Member

Australia
3 Posts

Posted - 07/03/2012 :  17:09:06  Show Profile  Reply with Quote
Here’s one that’s got me stumped. I found one old thread from someone with the exact same problem, but no clues.
The bulk statement works fine when run by itself. But when using EXEC, it will work for maybe 3-5 times, then give the error:

Cannot bulk load. Invalid destination table column number for source column 1 in the format file "D:\DMS_Import\_BAT_FMT_Files\CustOrds.fmt".

set @sql = 'BULK INSERT '+@BulkTableName+' FROM '+''''+ @FileToImport+''''+ ' WITH (FORMATFILE= '+''''+@FormatFile+''''+')'
EXEC(@sql)
The @sql value is:
BULK INSERT BULK_CustOrds FROM 'D:\DMS_Import\CustOrds.txt' WITH (FORMATFILE= 'D:\DMS_Import\_BAT_FMT_Files\CustOrds.fmt')

I need to do this in a loop so I can import many files with different formats. Any ideas?

herbau
Starting Member

Australia
3 Posts

Posted - 07/05/2012 :  16:16:58  Show Profile  Reply with Quote
A reinstall seems to have fixed the problem.
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
35007 Posts

Posted - 07/05/2012 :  16:31:47  Show Profile  Visit tkizer's Homepage  Reply with Quote
quote:
Originally posted by herbau

A reinstall seems to have fixed the problem.



Thank you for posting back. Did the build number of SQL Server change for the reinstall? Like a service pack or hotfix/CU was installed that wasn't there previously?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000