Snowflake Vs MS-SQL - Part 57 - Affected Rows - SQLROWCOUNT

    



Affected Rows - SQLROWCOUNT

DML commands are part of our day-to-day life. After DML command execution if

you want to get the number of records executed you can get it by row count.


In this case, you are inserting 6 records in a table and you should get that count 

i.e. six.



        INSERT INTO Main_Table (store_ID, province, profit)
        VALUES
                (1, 'Ontario', 500),
                (2, 'Saskatchewan', 500),
                (3, 'Ontario', 450),
                (4, 'Ontario', 450),
                (5, 'Saskatchewan', 450),
                (6, 'USA', 650)  
                ;



 

MS-SQL Server 

You can achieve this by using System Variable @@RowCount as below.





However, in Snowflake we can achieve this by using 

similar variable SQLROWCOUNT.





For more details, you can refer to the following SQLROWCOUNT.


 

Comments

Popular posts from this blog

Snowflake Vs MS-SQL - Part 36 - SPLIT_TO_TABLE

Snowflake Vs MS-SQL - Part 63 - ON Clause & Cross Join

Snowflake Vs MS-SQL - Part 33 - INITCAP