August 14, 2002 at 5:42 am
In a T-SQL script, how do you write you results to a file?
Right now I'm using "print" to display the results in the Query Analyzer result pannel, but need to actually dump the results to a file
August 14, 2002 at 5:50 am
You can use sp_oacreate to run the filesystemobject, put the results in a table and export using DTS. Thats two to start with.
Andy
August 14, 2002 at 5:54 am
If you're running the script from query analyser you can simply output to a file (not gird or text) by specifying on the toolbar (or tools - options menu)
Regards,
Andy Jones
.
August 14, 2002 at 11:35 am
There is also the option of using xp_cmdshell and the echo command (> to create a new one, >> to append) at the DOS level. You may have to build the xp_cmdshell string dynamically. This won't work if you're running as an account that doesn't have sysadmin rights unless you have granted EXECUTE rights to a non-sysadmin account (not a good idea).
K. Brian Kelley
http://www.truthsolutions.com/
K. Brian Kelley
@kbriankelley
August 14, 2002 at 12:22 pm
DTS is usually my vote.
Steve Jones
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply