bcp File without Field DelimiterPosted: November 10, 2014
I came across to this question last year. Without digging too much, I came up with a T-SQL solution to export everything in one huge column. But it involves a lot data type convert code. The reader came back with the same question again and I tried to play with bcp again and found the solution.
I used the HEX value no space 0x90 or 0x8F as the field delimiter to export the file directly
DECLARE @logtext AS VARCHAR(4000), @cmd AS VARCHAR(4000) set @logtext = '"select * from PRCARGEAFS2ALGE.EDI_DATA.dbo.EDI_810_READY_TO_EXPORT "' DECLARE @cmd6 NVARCHAR(4000) set @cmd6 = 'BCP ' + @logtext + ' queryout "C:\temp\sales1.txt" -c -t 0x90 -T -S'+ @@servername exec master..xp_cmdshell @cmd6 I provided the concatenate query solution (workaround): http://forums.asp.net/t/1922802.aspx?Export+query+to+Text+file+without+tab+delimited