I am reading the body of an email into a parameter (multi lined) i want to write this out to a text file. I have the following which will only write one line but i need to keep the lines split as they appear in the email, can anyone help?
Declare @Script varchar(8000)
Set @Script = 'Echo test > c:testfolder\testfile.txt'
exec master..xp_cmdshell @Script, no_output