Showing posts with label catch. Show all posts
Showing posts with label catch. Show all posts

Friday, March 9, 2012

How to get Procedure call text from within SQL Stored Procedure

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
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.codecomments.com ***
|||Thanks a lot.
dbcc inputbuffer was exactly what I was looking for.
PFI
nigelrivett a crit :

> 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.codecomments.com ***

How to get Procedure call text from within SQL Stored Procedure

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
PFIhave 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.developersdex.com ***|||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
> > > *** Sent via Developersdex http://www.developersdex.com ***

How to get Procedure call text from within SQL Stored Procedure

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
PFIhave 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.codecomments.com ***|||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.codecomments.com ***