Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

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


Report this thread to moderator Post Follow-up to this message
Old Post
PFI
12-12-06 12:13 AM


Re: How to get Procedure call text from within SQL Stored Procedure
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 ***

Report this thread to moderator Post Follow-up to this message
Old Post
nigelrivett
12-12-06 12:13 AM


Re: How to get Procedure call text from within SQL Stored Procedure
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 ***


Report this thread to moderator Post Follow-up to this message
Old Post
PFI
12-12-06 10:17 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 08:33 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006