Results 1 to 2 of 2

Thread: how to carried proc print output to a .txt file?

  1. #1
    Join Date
    Mar 2003
    Posts
    383

    how to carried proc print output to a .txt file?

    For certain reason, I set nocount off in the proc procABC.
    I need to collect all the counters(Ins/Upd/Del) and
    print statment on the isql/w screen to a .txt file.

    How could I capture all the running info as a daily log file?

    thanks
    David

  2. #2
    Join Date
    Dec 2004
    Posts
    502
    To capture the row count in a proc, you can use the @@ROWCOUNT function:

    DECLARE @rowcount bigint

    UPDATE YourTable SET ...
    SET @rowcount = @@ROWCOUNT

    SELECT @rowcount


    You can output the results of a proc to a text file by using the osql command in a batch file:

    osql -SServerName -E -Q"exec YourDatabase..YourStoredProcedure" > c:\YourPath\YourTextFile.txt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •