Posts

Showing posts from June, 2025

Snowflake Vs MS-SQL - Part 72 - First Sunday Of The Month

Image
         First Sunday Of The Month Sometimes, you have to calculate the first day of the month, like the first Sunday. You have to use that date for further calculation or filtering. Suppose you are running the query today, i.e., 28-Jun-2025, and if you want to know the date of the 1st Sunday of this month, i.e., 01-Jun-2025. MS-SQL Server   We can achieve this as follows: In  Snowflake,  we can use a similar approach .  For more details, you can refer to the following:  DATE_TIME . Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

Snowflake Vs MS-SQL - Part 71 - Data Is Numeric Or NOT

Image
         Data Is Numeric Or NOT While applying your business logic, you need to check whether the data present in a particular column is Numeric or Text . Based on this, your logic will vary.   COL2       IS_NUMERIC   1           true   2           true   3 . 0         true   A           false   B           false MS-SQL Server   We can achieve this by using the function ISNUMERIC as below: In  Snowflake,  we can use a similar approach; we can use   TRY_TO_NUMBER  as below. For more details, you can refer to the following:  TRY_TO_NUMBER . Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

Snowflake Vs MS-SQL - Part 70 - UNION By Name

Image
        UNION By Name Sometimes, we have to combine data from multiple tables. In this case, we can use UNION. However, the catch is that the order of the columns should be the same. MS-SQL Server   We can achieve this by using UNION as below: In  Snowflake,  we can use  the same query as above; however, we have to use the same column order in the select clause. However, we can use  UNION BY Name   as below. The order of the columns in the  select clause does not matter. NOTE: Similarly, you can use  UNION ALL BY NAME . For more details, you can refer to the following:  UNION . Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

Snowflake Vs MS-SQL - Part 69 - Flow Operator To Save Result-set Temporary

Image
         Flow Operator To Save Data Temporary Many times you have to execute multiple SQL statements and you have to save the result-set temporary which will be used in next SQL statement. MS-SQL Server   We can achieve this by using temporary tables. Also you can use CTE as below: In  Snowflake,  we can use similar approach, however it has an additional operator  Flow Operators,  as below: For more details, you can refer:  FLOW_OPERATOR  &  ARRAY_TO_STRING . Yogesh Shinde LinkedInProfile <<< Back   Next >>>