Posts

Snowflake Vs MS-SQL - Part 95 - Date and Time - INTERVAL

Image
Date and Time - INTERVAL Often, you need to add a duration/interval to an existing date. MS-SQL Server We can achieve it as follows: In  Snowflake ,    we can use a similar approach as above; however, we can make use of the new data type  INTERVAL  as follows: For more details, refer to the  INTERVAL  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series

Snowflake Vs MS-SQL - Part 94 - BOOLAND_AGG

Image
BOOLAND_AGG If you want to identify values that are the same as the given criteria. In the table below, all orders have an order_status of SHIPPED. ORDER_ID   ORDER_STATUS 1         SHIPPED 2         SHIPPED 3         SHIPPED 4         SHIPPED MS-SQL Server We can achieve it as follows: In Snowflake,  we can use  the same query as above; however, we can use   BOOLAND_AGG  as follows: For more details, refer to the  BOOLAND_AGG  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series  

Snowflake Vs MS-SQL - Part 93 - MERGE ALL BY NAME

Image
MERGE ALL BY NAME If you are performing upsert operations, you need to provide a list of columns in the Update as well as the Insert clause. MS-SQL Server   We can achieve it as follows: In Snowflake, we can use  the same query as above; however, we can use   MERGE  as follows: For more details, refer to the  MERGE-By-Using-All-By-Name  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series

Snowflake Vs MS-SQL - Part 92 - Stop or Cancel the Running Query

Image
Stop or Cancel the Running Query While executing a query, we noticed it was taking unusually long to complete. In such situations, it’s important to know how to safely stop or cancel the execution to avoid performance bottlenecks and system impact. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use  CANCEL_QUERY  as follows: For more details, refer to the  CANCEL_QUERY  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series

Snowflake Vs MS-SQL - Part 91 - ARRAY UNNEST - FLATTEN

Image
ARRAY UNNEST - FLATTEN If you have an array saved in a table and want to generate each value in each row as below: MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use  FLATTEN  as follows: For more details, refer to the  FLATTEN  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series

Snowflake Vs MS-SQL - Part 90 - Replace the String - INSERT - STUFF

Image
Replace the String - INSERT - STUFF If you want to delete a part of a string and then insert another string into the original string at a specified position. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use INSERT  as follows: For more details, refer to the  INSERT  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series

Snowflake Vs MS-SQL - Part 89 - Form the DATE from Parts DATE_FROM_PARTS

Image
Form the DATE from Parts DATE_FROM_PARTS If you want to form the date from Parts like Day, Month & Year. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use a similar approach as above; however, we can use  DATE_FROM_PARTS  as follows: For more details, refer to the  DATE_FROM_PARTS  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

Snowflake Vs MS-SQL - Part 88 - Count of non-NULL records of the column using ILIKE

Image
Count of non-NULL records of the column using ILIKE If you want to get the Count of non-NULL records of the column. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use a similar approach as above; however, we can use  ILIKE  as follows: For more details, refer to the  ILIKE  section. Yogesh Shinde LinkedInProfile     <<< Back   Next >>>

Snowflake Vs MS-SQL - Series

Image
Snowflake Vs MS-SQL - Series Part 111 -  Extract a Year from the DATE   -  Part 111 Part 110 - Convert Data Type - Parse and Save XML - Part 110 Part 109 - Convert Data Type - Decimal to Integer  - Part 109 Part 108 - Filter Columns in Result Grid  - Part 108 Part 107 - Create or Alter Table - Add Column - Part 107 Part 106 - Table Structure - Describe - Part 106 Part 105 - PIVOT - Custom alias to column name - Part 105 Part 104 - Row Comparison - HASH - Part 104 Part 103 - ORDER BY ALL - SORTING - Part 103 Part 102 - Last Value in the Series - Part 102 Part 101 - Trigonometry Functions - Geometry - Part 101 Part 100 - Split String into Different Columns - Part 100 Part 99 - Multi-Table Insert based on condition - Part 99 Part 98 -  Create Table If Not Exists - Part 98 Part 97 - Identify Data Type - SYSTEM$TYPEOF - Part 97 Part 96 -  Row Last Updated - ROW_TIMESTAMP   -  Part 96 Part 95 -  Date and Time - INTERVAL   -  Par...

Snowflake Vs MS-SQL - Part 87 - UTC Time - CONVERT TIMEZONE

Image
          UTC Time - CONVERT TIMEZONE Many times you get the time inthe local time zone, but you want to display the same time in UTC Time Zone. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use a similar approach; however, we can use  CONVERT_TIMEZONE  as follows: For more details, refer to the  CONVERT_TIMEZONE  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>>

Snowflake Vs MS-SQL - Part 86 - Modulus/Modulo Function - Remainder

Image
Modulus/Modulo Function - Remainder While calculating, if you want to find the remainder, then we can use this. MS-SQL Server   We can achieve it as follows: In  Snowflake ,  we can use a similar approach; however, we can use  MOD  as follows: For more details, refer to the  MOD  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

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 >>>