How to spool the output from a script?

  • I am scripting a audit file in a SQLServer database...I have used ORACLE in the past and utilized the spool command...which allows you to programmatically send your results set to a file...I am using SQL Query Analyzer at the moment and the only way, I can save my output is via the Query menu....is the functionality available to send your output to a file via a script??

    Thanks,

    Sandy

  • you can use the osql commandline utility to write the output to a file.

  • Note sure of anything in QA but ISQL and OSQL support output files and can be > to txt. These are of course command line products included with SQL Server.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • In QA there is a option called "Results to File" under the "Query" menu, or you can use "Cntl+Shift+F".

    If I am building a batch type script, I always use "osql".

    Also "osql" can be called via QA using "xp_cmdshell".

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

    Gregory A. Larsen, MVP

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply