-
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
-
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
-
Forum Rules
|
|