Hi Brian, There are two queries in this blog post, but you don’t say which one you are having a problem with. You also don’t say what version of SQL Server you are trying to run them on. Both of these queries will work on any recent version of SQL Server. They are both part of my Diagnostic Information Queries, which are used by thousands of people around the world.
If you can be more specific, I might be able to help you.
]]>Msg 102, Level 15, State 1, Line 7
Incorrect syntax near ‘/text’.
Msg 319, Level 15, State 1, Line 11
Incorrect syntax near the keyword ‘with’. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 156, Level 15, State 1, Line 17
Incorrect syntax near the keyword ‘AS’.
Msg 319, Level 15, State 1, Line 18
Incorrect syntax near the keyword ‘with’. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Msg 319, Level 15, State 1, Line 19
Incorrect syntax near the keyword ‘with’. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
Hi Matus, I’m not sure what you actually mean. That query absolutely works. If there is no blocking, it won’t return any results, but it does not error out.
]]>thank you very much for this blog.
Could you please verify Query #36 – Detect Blocking?
I tried to run this T-SQL code in various of MS SQL server’s versions but still failed.
I tried to “fix” it but without success.
Thanks.
Regards,
matus knut