The issue:
I had a stored procedure that uses bcp to export data from a table and surprisingly all nulls were being exported as spaces. I tried explicitly using ISNULL to populate an empty string, tried replacing nulls with empty string in the table itself; but no luck. Google didn't have anything useful either.
The solution:
Specifying the COLLATE attribute on all the character columns to use COLLATE SQL_Latin1_General_CP1_CI_AS as shown below:
[EMAIL_ADDR] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
After adding this to the source table, all nulls were exported as blanks with a simple bcp out.
Dedicated to that lone programmer somewhere breaking his/her head to figure out the solution to this issue :)
No comments:
Post a Comment