SQL BCP exporting to ASCII
Posted on 2014-07-25
I am trying to export data from an SQL table using BCP using the script below:
select @sql = 'bcp "exec bloc700dummy.dbo.reptoolGetCustomers @Salesman = MS" queryout "C:\Reptool\CustomerMS.txt" -T -c -S'
The resultant datafile is then used as data for a dropdown within a VB.Net application. I have an issue where if a data column within the SQL table contains nothing, it is exported as what apperas to be 0X0 which I believe is HEX for a space. The problem I have is that when I try to concatenate fields of data together (address details), as soon as an empty field is encountered, any data after that field is lost!
Can anyone advise if there is a different switch combination I can use within BCP to stop this happening or can I code around this within my application?