December 2, 2003 at 5:50 pm
I am working on bcp script which suppose to export data from certain DB tables and import them back after their structure is updated (for example column inserted).
Looks like BCP is not "intelligent enough" to recognize that a new coulumn was inserted because my import fails with
"Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file
".
I had no this problem with DTS, but in my case I need a universal script where I can put db_name as a variable so one script can be used for various customer's DBs.
From what I understood I have to create export/import DTS packages for each of customer's DBs if I go with DTS for that same purpose. Even if all of these DBs schemas are identical.
So I guess my question is:
Is it possible to make bcp to recognize table structure changed when importing data?
Thank you.
December 2, 2003 at 9:36 pm
bcp uses a format file to handle schema configuration as long as you pass an appropriate format file in the command line it should be ok
* Noel
December 3, 2003 at 11:48 am
I understood my choices are:
1) use DTS with parameters. which I am looking into right now.
2) use perl to format the file before importing with bcp (which seems to be more complicated because we need to install perl libs, etc.).
Any other choices I may not be aware of?
Thanks,
Sabina
December 3, 2003 at 12:33 pm
what I am talking about is that you can CREATE the FORMAT file not the DATA file every time before you import. The Format file tells bcp what are the columns mappings that it should use for source and destination. You cause anything (not only perl) that help you create a text file with the appropriate structure
* Noel
December 3, 2003 at 2:57 pm
quote:
what I am talking about is that you can CREATE the FORMAT file not the DATA file every time before you import.
Oh, I see. Thanks a lot for the clue!
Sabina
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply