Re: capture and save running sql query to database table (for logging)
by "Plamen Ratchev" <Plamen@[EMAIL PROTECTED]
>
Apr 25, 2008 at 08:59 AM
It is good to note here that DBCC INPUTBUFFER requires the user executing
to
be member of the sysadmin fixed server role. One way to handle this is to
specify user or login with sufficient privileges in EXEC (you can use EXEC
AS LOGIN or USER:
INSERT INTO SQLLog (language_event, parameters, event_info)
EXEC('DBCC INPUTBUFFER(@[EMAIL PROTECTED]
);') AS LOGIN = 'admin_login';
HTH,
Plamen Ratchev
http://www.SQLStudio.com