ACTIVITY_COUNT

Translation specification for the ACTIVITY_COUNT status variable.

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Description

The ACTIVITY_COUNT status variable returns the number of rows affected by an SQL DML statement in an embedded SQL or stored procedure application. For more information check here.

There is no direct equivalent in Snowflake. However, there is a workaround to emulate the ACTIVITY_COUNT's behavior. One must simply use the following query:

SELECT $1 FROM TABLE(RESULT_SCAN(LAST_QUERY_ID()));

This query retrieves and returns the first column of the result set from the last executed query in the current session. Furthermore, $1 can be replaced by "number of rows inserted", "number of rows updated" or "number of rows deleted" based on the query type.

As expected, this translation behaves like its Teradata counterpart only when no other queries besides the SQL DML statement are executed before calling LAST_QUERY_ID.

Sample Source Patterns

Setup data

Teradata

Snowflake

Supported usage

Teradata

Snowflake

Known Issues

  1. If ACTIVITY_COUNT is called twice or more times before executing a DML statement, the transformation might not return the expected values. Check here.

  2. If ACTIVITY_COUNT is called after a non DML statement was executed, the transformation will not return the expected values. Check here.

  3. ACTIVITY_COUNT requires manual fixing when inside a SELECT/SET INTO VARIABLE statement and was not able to be identified as a column name. Check here.

  1. SSC-FDM-TD0033: 'ACTIVITY_COUNT' TRANSFORMATION MIGHT REQUIRE MANUAL ADJUSTMENTS.

Last updated