• UncleBoris (6/13/2013)


    Out of curiosity -- what does this line "WHERE st.objectid IS NULL" do?

    Filters out rows in the statement text that have object IDs and database IDs, ie stored procedures. It's an odd way of filtering for ad-hoc SQL statements only, was in your original query so I left it there, but it's a really odd filter to use. A more obvious way of doing that would be to filter for ObyType IN ('Adhoc','Prepared')

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass