write cursor output to a file

  • Is there an easy way to write the output of a cursor to a file from within a stored procedure? Someone suggested using Osql?

  • You will have to use sp_OQCreate to open a file system object and write in the data unless you are using DTS.

  • osql -Sserver

    -E -ddatabase -Q"EXEC sproc" -o"C:\temp\OSQLOutput.txt"

     

    The file will contain your output.  Put the cursor in a stored procedure.

    The file will need to be cleaned though, as it will contain row headings.

     


    When in doubt - test, test, test!

    Wayne

  • I actullay just resolved this, I turned to DTS in the end, created an ActiveX task and used ADO and FSO. Out of interest it was to build an HTML file that I used within xp_smtp_sendmail and attach it as a messagefile. Thanks for the pointers

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

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