Getting the query ID of the last query¶
If you need to access the query ID of the last query that was executed, use the global variable SQLID.
Note
If no query was executed, the default value of SQLID is NULL.
The following example executes two queries and returns an ARRAY containing the query IDs:
Note: If you use Snowflake CLI, SnowSQL, the Classic Console, or the
execute_stream or execute_string method in Python Connector
code, use this example instead (see Using Snowflake Scripting in Snowflake CLI, SnowSQL, and Python Connector):