Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 BCP tab issues

Author  Topic 

SkinniPM
Starting Member

1 Post

Posted - 2012-02-08 : 20:27:45
Hi there (what a great forum)!!!
Hopeing that someone here can help me a bit as i am officially stuck. I am exporting data out via BCP to a file and then emailing the file automatically which works fine for 6 months. But now the person receiving the file states that the file is not and has not been in the correct format and they want it Tab delimited without blank spaces.
Now the file has around 40 rows that are tab delimited but when a row is blank it places a blank space then it tabs and i need to remove the blank space all together. i.e. (tabblankspacetabblankspacetab) they want (tabtabtabtab)

My code is as follows and i have tried so manythings to acheive this outcome that i am now chasing my tale

DECLARE @FileName varchar(100),
@CMMD varchar(3000),
@cmd VARCHAR(2048)

SET @FileName = REPLACE(' \\server\Installation$\Documentation\Apps_Procedure\Barcodes\Weekly\'+replace (CONVERT(char(12),GETDATE(),105),'-','')+'.tic','/','-')
SET @CMMD = 'BCP "select * from barcode order by len(EventCode)desc" queryout'
Set @CMMD = @CMMD + @FileName + ' -c -U user -P password -S Server'


I am currently referencing a view in the select statement but have tried also referencing the data straight from the tables with the same result set.

Is there something i can do please?

Cheers
SKINNI
   

- Advertisement -