Using DBCC INPUTBUFFER()

  • Hi,

    within a trigger I use the command DBCC INPUTBUFFER (@@SPID) WITH NO_INFOMSGS to capture the statement that the client has sent to the server.

    The column EventInfo, however, contains only the first 255 characters of the statement.

    I need to know the entire text of command, do you have any suggestion for me ?

    Thank you

    Sergio

  • By default only the first 256 characters are returned in Query Analyzer/ Management Studio. To do increase this, go to the 'Results to Text' tab under Tools > Options > Query Results > SQL Server > . You can then increase the Maximum Characters displayed in each column.

    @SQLvariant

  • Why would you need to know the original SQL Statement ?

    Note also that only someone with sysadmin rights can run

    DBCC INPUTBUFFER and most sites will not allow sysadmin except DBAs, and with SQL Server 2005/2008, even that level of privilege is not being allowed.

    Recommend another solution.

    SQL = Scarcely Qualifies as a Language

  • Carl Federl (5/13/2008)


    Why would you need to know the original SQL Statement ?

    I need to know the statement T-SQL to track DML commands in a audit trigger.

    Thank you

    Sergio

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply