Obtaining the hash key from the SQL text

A hash key is generated based on a statement’s text, and acts as an approximate key for the search mechanism in the statement cache. Since other monitoring tables display the statement’s text, you can use the hash key as an approximate key to look up and compare SQL text in these tables.

For information about viewing the entire SQL text of a cached statement, see “Displaying text and parameter information for cached statements,” below.

Adaptive Server includes two functions you can use to effectively compute the hash key. Use parse_text to verify the validity of the SQL text before computing the hash key. The syntax is:

select parse_text(text, prm_opt)

Valid values for prm_opt are:

If the SQL text is invalid, the parse_text function returns null.

Use hashbytes to compute the hash key over the statement’s text. For example:

select hashbytes('xor32', 'select * from syskeys')