I am using the below code to create a text file from SQL server 2005.
DECLARE @vCmd VARCHAR(MAX)
DECLARE @vCLUEDATE VARCHAR(MAX)
DECLARE @vWorkfilename VARCHAR(MAX)
SET @vCLUEDATE = '000000001EFHRCF01FF 20110718205227VERI2011071820110718 2'
SET @vWorkfilename = 'F:\ClueUpload\CVGVER.20110718.0101.txt'
Select @vCmd = 'echo ' + @vCLUEDATE + '>' + @vWorkfilename
EXEC master..xp_cmdshell @vCmd
But it is creating the file without data, but it should create with one line of data.
Then i changed the @vCmd as below
Select @vCmd = 'echo ' + @vCLUEDATE + ' > ' + @vWorkfilename
then it is working. but it is adding one space to the end of line that is after 2 it is adding. but i don't want that space, so how can I do this.
Please help me on this...
Sarath Babu Vellampalli