I know how to write to a text file using:
DECLARE @MyText nvarchar(500)
SET @MyText = 'type This is my text >> c:\MyLog.txt'
exec master..xp_cmdshell @MyText
What I want to know is how do I write multiple lines to MyLog.txt without having to call out xp_cmdshell each time I want a new line in my log? Do I use newline character in @MyText like SET @MyText = 'type This is my text line 1</n>This is line2 >> c:\MyLog.txt'