SQL Server errors are shown in Azure Log Analytics. Sometimes, the query_hash_s column is populated. But the values provided appear to be BIGINT. How can I use that value to find the actual text of the SQL statement using sys.dm_exec_sql_text? Simply converting the value to a VARBINARY(64) doesn't work.

Example value: 621553112374777528

SELECT CONVERT(VARBINARY(64), 621553112374777528)

results in 0x12000001B81623384333A008, whereas sys.dm_exec_sql_text is looking for a value that looks more like this (this is a different value, shown only to illustrate the length difference):


  • There's some absurdly complicated instructions here. Does this help you at all? – Erik Darling Mar 27 '18 at 22:46
  • @sp_BlitzErik I gave it a try, and the "Single Query Hash comparison" produces a "Hash is not equal" result and the "Query Hash comparison extended to DMV" doesn't produce any result. I'm not sure what that means. – Mark Freeman Mar 28 '18 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.