Hellow you all,
An interesting difference between dos en SQL has come to my attention....
A carriage return/linefeed in SQL is realised by 'char(13) char(10)...if u'd like to realise a CR/LF in DOS using xp_cmdshell, the story changes:
The char(x) is of no use, u'll have to use '&' to indicate a CR/LF.
At a DOSprompt the following works fine:
'C:>echo line1 &echo line2'
Results is :
line1
line2
Using xp-cmdshell, the following also works fine:
exec master .. xp_cmdshell 'echo line1 &echo line2'
...HOWEVER....
exec master .. xp_cmdshell 'echo line1 &echo line2 >> C:\test.txt'
does NOT work!,....only 'line2' is written to the textfile.
'Line1' appears (if 'NO_OUTPUT' is not present) as SQL output....
Does anyone know how i should put togehter the exec code line in order to get both lines with a CR/LF written to the text file???
Please ask me if the text is a bit too vague
ThenX in @vance
RuupY
An interesting difference between dos en SQL has come to my attention....
A carriage return/linefeed in SQL is realised by 'char(13) char(10)...if u'd like to realise a CR/LF in DOS using xp_cmdshell, the story changes:
The char(x) is of no use, u'll have to use '&' to indicate a CR/LF.
At a DOSprompt the following works fine:
'C:>echo line1 &echo line2'
Results is :
line1
line2
Using xp-cmdshell, the following also works fine:
exec master .. xp_cmdshell 'echo line1 &echo line2'
...HOWEVER....
exec master .. xp_cmdshell 'echo line1 &echo line2 >> C:\test.txt'
does NOT work!,....only 'line2' is written to the textfile.
'Line1' appears (if 'NO_OUTPUT' is not present) as SQL output....
Does anyone know how i should put togehter the exec code line in order to get both lines with a CR/LF written to the text file???
Please ask me if the text is a bit too vague
ThenX in @vance
RuupY