bulk_copy_tables.cmd fails if the bcp query length is exceeded.
Once it fails, all subsequent tables are omitted from the import_<database>.sql file.
The length is exceeded because all text fields are converted to 'CAST( [field] as NVARCHAR(len)) as [field]'. So instead of just [field], it includes the CAST...
Proposed Fix:
The addition of the CAST should be made optional, or indicated.
I don't think it is even necessary when converting from Latin1 to UTF-8.
The length of the bcp query should be calculated and a warning given.
Workaround:
1) Remove the block that is going to fail and run it again.
2) Use Toad to export the data.
Once it fails, all subsequent tables are omitted from the import_<database>.sql file.
The length is exceeded because all text fields are converted to 'CAST( [field] as NVARCHAR(len)) as [field]'. So instead of just [field], it includes the CAST...
Proposed Fix:
The addition of the CAST should be made optional, or indicated.
I don't think it is even necessary when converting from Latin1 to UTF-8.
The length of the bcp query should be calculated and a warning given.
Workaround:
1) Remove the block that is going to fail and run it again.
2) Use Toad to export the data.