Displays the SQL text of a cached statement.
show_cached_text(statement_id)
is the ID of the statement. Derived from the SSQLID column of monCachedStatement.
Displays the contents of monCachedStatement, then uses the show_cached_text function to show the SQL text:
select InstanceID, SSQLID, Hashkey, UseCount, StmtType from monCachedStatement
InstanceID SSQLID Hashkey UseCount StmtType ---------- ---------- ---------- ----------- -------- 0 329111220 1108036110 0 2 0 345111277 1663781964 1 1
select show_cached_text(329111220)
-------------------------------------- select id from sysroles
show_cached_text displays up to 16K of SQL text, and truncates text longer than 16K. Use show_cached_text_long for text longer than 16K.
show_cached_text returns a varchar datatype.