I'm currently using
EXEC xp_cmdshell 'ECHO Hello > c:\file.txt'
EXEC xp_cmdshell 'ECHO World >> c:\file.txt'
To create and append text files from sql server. I get
Hello
World
as the result.
How can I using separate commands add both 'Hello' and 'World' on the same line in the output file so that I would end up with the file that looks like
Hello World
I need to do this because xp_cmdshell has a limit of 8000 characters.
This seems to work
EXEC xp_cmdshell 'echo | set /p=Hello > c:\file.txt'
EXEC xp_cmdshell 'echo | set /p=World >> c:\file.txt'