Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-12-28 : 17:41:27
|
John writes "I have an Audit sproc that is called from other sprocs. It inserts values into a table to provide an audit trail of changes to the database. The Audit sproc accepts the calling sproc name and its parameters.
QUESTION: Is there a way to dynamically determine the calling procedure name and its parameters from within spAudit without explicitly passing the information to spAudit?
---John Duncan--- SAMPLE CODE:
CREATE PROC spUpdateUserName @iUserID int, @vchUserName varchar(20) AS BEGIN (---detail omitted---) EXEC spAudit spUpdateUserName,@iUserID,@vchUserName END
CREATE PROC spAudit @vchSprocName varchar(20), @vchParam1 varchar(20), @vchParam2 varchar(20) AS BEGIN DECLARE @vchParamList varchar(1000) SET @vchParamList = @vchParam1 + ',' + @vchParam2
INSERT INTO AuditLog (SprocName,ParamList) VALUES (@vchSprocName,@vchParamList) END" |
|
|
|
|
|