Snowflake snippets
How to get information and the results of the last executed query
Let’s say you already executed the following simple query
SELECT
'John' AS Name,
DATE_TRUNC(month, CURRENT_DATE()) AS first_day_of_current_month;
And you accidentally closed the results page.
To get the information about the last executed query you can just use the following
DESCRIBE RESULT LAST_QUERY_ID();
While, if you want to also retrieve the results of the executed query, you can execute the following
SELECT *
FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));