• If you want to find out the actual statement executed at the start of the sql call stack than you can get it (up to 4000 characters) by calling DBCC INPUTBUFFER. The dmvs to get the same data does not return the start of the call stack.

    DECLARE @SQL NVARCHAR(4000)

    DECLARE @IBuf TABLE (EventType nvarchar(30) NULL, Parameters INT NULL, EventInfo nvarchar(4000) NULL)

    INSERT @IBuf

    EXEC('DBCC INPUTBUFFER(@@spid) WITH NO_INFOMSGS')

    SELECT @SQL = EventInfo FROM @IBuf

    SELECT @SQL