Posts

Showing posts from January, 2026

Snowflake Vs MS-SQL - Part 85 - UNION ALL BY NAME

Image
        UNION ALL BY NAME Sometimes, we have to combine data from multiple tables. In this case, we can use UNION or UNION ALL. However, the catch is that the column order or the number of columns in both tables must be the same. MS-SQL Server   We can achieve this  using  UNION  as shown below,  specifying the column names. We cannot use (*) in the select clause as the number of columns and their names are different: In  Snowflake ,  we can use  the same query as above; however, we can use the  (*) in the select clause  with  UNION ALL BY NAME   as below. The order of the columns in the  select clause does not matter. For more details, you can refer to the following:  UNION_ALL_BY_NAME . Yogesh Shinde LinkedInProfile <<< Back   Next >>>    

Snowflake Vs MS-SQL - Part 84 - EXTRACT Day/Month/Year

Image
            EXTRACT Day/Month/Year Sometimes you have to extract Day or Month, or Year from a Date. MS-SQL Server   We can achieve it as follows: In  Snowflake,  we can use a similar approach; however, we can use  EXTRACT  as follows: Note: You can use EXTRACT to convert the timestamp to its  Unix epoch  time  representation as below: For more details, refer to the  EXTRACT  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>>

Snowflake Vs MS-SQL - Part 83 - Compare NULL - IS NOT DISTINCT FROM

Image
            Compare NULL - IS NOT DISTINCT FROM Sometimes you have to compare with NULL in the WHERE clause. MS-SQL Server   We can achieve it as below: In  Snowflake,  we can use a similar approach; however, we can use  IS NOT DISTINCT FROM   as below: For more details, refer to the  IS_NOT_DISTINCT_FROM  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>>    

Snowflake Vs MS-SQL - Part 82 - Generate Unique Identifier

Image
            Generate Unique Identifier Sometimes, we need to generate a unique identifier and use it consistently throughout our code. MS-SQL Server   We can achieve it by using built-in functions as follows: In  Snowflake,  we can use a similar function,  UUID_STRING (),  as below : For more details, refer to the  UUID_STRING  section. Yogesh Shinde LinkedInProfile   <<< Back   Next >>>