How to output tab [CHAR(9)] in EXEC

Viewed 18915

I know I can do the following:

DECLARE @Tab CHAR(1)
SET @Tab = CHAR(9)
EXEC('xp_cmdshell ''echo ' + @Tab + 'Some text>> C:\test.txt'', NO_OUTPUT')

But is there a way to do this in 1 line? I.e. remove the need to declare and set tab, and output it directly in the EXEC?

2 Answers
Related