Home > Archive > MS SQL Server > December 2006 > How to get Procedure call text from within SQL Stored Procedure









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to get Procedure call text from within SQL Stored Procedure
PFI

2006-12-11, 7:13 pm

Hi,

I'm using SQL Server 2005.
I have implemented some SPs with the TRY..CATCH structure and each time
that I have an error, I just log it into a dedicated LogError table.
I would like to add in LogError a column containing the command that
was used by the user (containing the Procedure Name and the calling
parameters)

Is there any way to perform it ?

Thanks

PFI

nigelrivett

2006-12-11, 7:13 pm

have a look at
http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html

The bits with
dbcc inputbuffer
and
fn_get_sql

Get the sql executed if it is available.
dbcc inputbuffer is more likely to have the user command.

Neither is guaranteed.

www.nigelrivett.net


*** Sent via Developersdex http://www.droptable.com ***
PFI

2006-12-12, 5:17 am

Thanks a lot.
dbcc inputbuffer was exactly what I was looking for.

PFI

nigelrivett a =E9crit :

> have a look at
> http://www.nigelrivett.net/SQLAdmin/sp_nrInfo.html
>
> The bits with
> dbcc inputbuffer
> and
> fn_get_sql
>
> Get the sql executed if it is available.
> dbcc inputbuffer is more likely to have the user command.
>
> Neither is guaranteed.
>
> www.nigelrivett.net
>=20
>=20
> *** Sent via Developersdex http://www.droptable.com ***


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com