September 20, 2010 at 6:46 am
i have stored procedure as follows
proc_multi_trans()
{
insert stmt
// here i want to make a log in a file tht insert is success
update stmt
// here i want to make a log in a file tht update cmd is success
delete stmt
// here i want to make a log in a file tht delete cmd is success
}
i want to make those log entries..can anyone tell me whts the best way to achieve this?. plzz help
September 20, 2010 at 6:59 am
if you mean you want this in the SQL error log and windows event log use the raiseerror command
Else the print or select command?
---------------------------------------------------------------------
September 20, 2010 at 7:07 am
thanks a lot for reply.... can i store this log in any file? i mean can i create my own error log file? logging my desirable information not only error information but also success information?
September 20, 2010 at 7:15 am
raiseerror goes to the SQL error log.
How is this stored procedure going to be run?
---------------------------------------------------------------------
September 20, 2010 at 7:40 am
mail4sha (9/20/2010)
thanks a lot for reply.... can i store this log in any file? i mean can i create my own error log file? logging my desirable information not only error information but also success information?
These two links may help u in writing to a text file.
http://www.nigelrivett.net/SQLTsql/WriteTextFile.html%5B/url%5D
http://www.eggheadcafe.com/software/aspnet/32965051/appending-to-text-file.aspx%5B/url%5D
September 20, 2010 at 7:51 am
actually in every SP i have to make a log entry of every tranction done within the SP. i have to log both success n failure of transaction.... any possible way other than RaiseError?
September 20, 2010 at 7:56 am
mail4sha (9/20/2010)
actually in every SP i have to make a log entry of every tranction done within the SP. i have to log both success n failure of transaction.... any possible way other than RaiseError?
Why dont you run a trace for this?
Other option may be writing triggers.
September 20, 2010 at 8:04 am
Hello Pradeep...
Please can u tell me how trace works... this is wht exactly i m looking for... can u pls explain?
September 20, 2010 at 8:20 am
September 20, 2010 at 8:26 am
Google!!
You can start here: http://technet.microsoft.com/en-us/library/ms175047.aspx%5B/url%5D
Run a server side trace. Use profiler to script out the trace definition. Doing it manually can be error prone.
This article of Gail will help you how to script out the trace definition and running it manually.
[url]http://www.simple-talk.com/sql/performance/finding-the-causes-of-poor-performance-in-sql-server,-part-1/"> http://technet.microsoft.com/en-us/library/ms175047.aspx%5B/url%5D
Run a server side trace. Use profiler to script out the trace definition. Doing it manually can be error prone.
This article of Gail will help you how to script out the trace definition and running it manually.
http://www.simple-talk.com/sql/performance/finding-the-causes-of-poor-performance-in-sql-server,-part-1/
September 20, 2010 at 11:22 pm
thanks a lot... i will try as u said....
September 21, 2010 at 2:23 am
take a note that running traces (even server side) will cause a performance degradation.
September 21, 2010 at 3:57 am
oh.. thanks for ur valuable information
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply