LAST_QUERY_ID

functionsupportedQueries & DML

docs.snowflake.com ↗

Context functions

Returns the ID of a specified query in the current session. If no query is specified, the most recent query is returned. Tip Instead of using this function with the RESULT_SCAN function to process the results of a previous command, you can use the pipe operator (->>). That way, you can run the command and process its result set in a single step.

Syntax

supportedpartialnot supportednot scored

LAST_QUERY_ID( [ <num> ] )

Parameters

NameRequiredDescription
numrequiredSpecifies the query to return, based on the position of the query (within the session). Default: -1

Usage notes

Referenced by