I am accustomed to performing all schema changes via DDL scripts. The only other SQL database I have done such detailed development work with is DB2 Universal Database. This time I am working with SQL Server 2008 R2.
So, I came across the bcp (bulk copy Porsch) utility in SQL Serer which seemed comparable to the export / import capabilities in DB2.
I need to add a couple of columns to one table. So order of script oertaion is as follows:
1) Export existing data
2) Drop the table
3) Create the table with additional columns / index
4) Disable IDENTITY
5) Import legacy data (Bang!!)
6) Re-Enable IDENTITY
7) Drop default values for the additional / new columns
At first it sounded like a no-brainer to allow bcp to use the -n Native format. bcp complains that: The Import did however import one record before banging. Only one of the two new columns received its default value, however.
So I have tried to use the -c encoding format along with a format file. Using this method just bangs right away and imports no rows.
I seem to be trapped in this type of error:
Is there some reason, such as bdc can not import back into a table with additional columns - even though default values are supplied for the additional columns - that bcp would be putting up such a fight?
So, I came across the bcp (bulk copy Porsch) utility in SQL Serer which seemed comparable to the export / import capabilities in DB2.
I need to add a couple of columns to one table. So order of script oertaion is as follows:
1) Export existing data
2) Drop the table
3) Create the table with additional columns / index
4) Disable IDENTITY
5) Import legacy data (Bang!!)
6) Re-Enable IDENTITY
7) Drop default values for the additional / new columns
At first it sounded like a no-brainer to allow bcp to use the -n Native format. bcp complains that: The Import did however import one record before banging. Only one of the two new columns received its default value, however.
So I have tried to use the -c encoding format along with a format file. Using this method just bangs right away and imports no rows.
I seem to be trapped in this type of error:
Does anyone have working sample command line syntax of how to get bcp to work properly?Unexpected EOF encountered in BCP data-file
Is there some reason, such as bdc can not import back into a table with additional columns - even though default values are supplied for the additional columns - that bcp would be putting up such a fight?