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;
![Snowflake snippet 34](static/img/CookBook/Snowflake/IMG_034.png)
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();
![Snowflake snippet 35](static/img/CookBook/Snowflake/IMG_035.png)
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()));
![Snowflake snippet 36](static/img/CookBook/Snowflake/IMG_036.png)
![Snowflake snippet 37](static/img/CookBook/Snowflake/IMG_037.png)