April 20, 2004 at 3:04 pm
Please help!
We are using BCP utility to create flat, comma delimited text files. Data is being read from MS SQL server tables and saved in the file on the network. Sometimes we are getting corrupted files with non-readable characters. Does anyone know why this could occur?
FYI Data in the database tables is migrated from FORTRAN files.
Thanks for your help,
Ella
April 22, 2004 at 1:14 pm
Ella
How are you migrating the data from FORTRAN? Were these files checked for errors?
April 23, 2004 at 10:35 am
These files are loaded into MS SQL tables. All fields in these tables are varchar.
April 23, 2004 at 12:22 pm
Ella
What I am trying to find out is whether you have checked the data in SQL Server, if its not corrupt when coming over from FORTRAN.
April 23, 2004 at 7:00 pm
Information in the table looks OK. We did some additional investigation and found out that data in corrupted fields is represented as 00 in HEX format. We expected to see this data as Hex 20 because we thought that we have single spaces there. We still don't understand how this could have happened.
April 25, 2004 at 10:18 pm
Hex00 is BCP's way of storing a blank string. It does this because it uses an empty field for Null.
(It could be argued that it would have been more logical if BCP would use a special character for Null and an empty field should be an empty string, but BCP just doesnt do that)
If you turn your empty strings into nulls you might get what you want - something like:
BCP "Select Nullif(col1,''), ..." queryout ...
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply