June 25, 2002 at 12:06 pm
How to spool the output from T-SQL to a text file. I have the output in the form of a local variable. So xp_cmdshell 'osql..' will not work.
June 25, 2002 at 2:01 pm
Preview
Try using echo:
declare @lvar varchar(500)
select @lvar='"@ECHO '+ @yourlocalvariable +' >> C:\YourOutputFile.txt"'
exec master..xp_cmdshell @lvar
Another way is to store your local var in a temp table and then use isql with -Q -o options
June 25, 2002 at 2:30 pm
You can use osql, just PRINT or SELECT your variable whenever you need output.
Steve Jones
June 25, 2002 at 3:46 pm
The @echo technique worked fine.
Thanks.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply