3

How do I convert the query hash string "0x9F37D9B585242D49" to a uint64 needed by my extended event filter? Casting to bigint doesn't work as the value goes negative.

event
sql_statement_completed

filter
field : sqlserver.query_hash
operator : equal_uint64
value ???
0

1 Answer 1

5

TSQL doesn't have unsigned 64bit integers, but .NET does.

var hash = 0x9F37D9B585242D49;
Console.WriteLine(hash);

outputs

11472877949395676489

And you also can filter on query_hash_signed and provide a singed 64bit integer, which TSQL can produce

select cast(0x9F37D9B585242D49 as bigint)

outputs

-6973866124313875127

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.