• Dear,

    I know this very old post but ..

    Solution is:-

    Use

    Select @vCmd = 'echo ' + @vCLUEDATE + CHAR(254) + '> ' + @vWorkfilename

    and then excute below bat file

    copy below code and make a bat file of that.

    for /f "tokens=1,* delims=]" %%A in ('"type %1|find /n /v """') do (

    set "line=%%B"

    if defined line (

    call set "line=echo.%%line:%~2=%~3%%"

    for /f "delims=" %%X in ('"echo."%%line%%""') do %%~X> %1

    ) ELSE echo.

    )

    run above batch file using xp_cmdshell as

    Select @vCmd = 'script.bat ' + @vWorkfilename + ' ' + CHAR(254)

    EXEC xp_cmdshell @vCmd

    I hope this will help.