Posts

Snowflake Vs MS-SQL - Part 97 - Identify Data Type - SYSTEM$TYPEOF

Image
Identify Data Type - SYSTEM$TYPEOF Sometimes, you have to find out the data type or nature of the data in the existing column during data analysis. MS-SQL Server We can do as follows: In  Snowflake ,  we can use  SYSTEM$TYPEOF  as follows: For more details, refer to the  SYSTEM_TYPEOF  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series   

Snowflake Vs MS-SQL - Part 96 - Row Last Updated - ROW_TIMESTAMP

Image
Row Last Updated - ROW_TIMESTAMP Many times, you have to find out when the record was updated last time MS-SQL Server We need to create a column in a table, like modified_date, which will store the value of datetime: In  Snowflake ,  we can use a similar approach as above; however, we can use  ROW_TIMESTAMP  as follows: For more details, refer to the  ROW_TIMESTAMP  section. Yogesh Shinde LinkedInProfile <<< Back   Next >>> Snowflake Vs MS-SQL - Series  

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 97 -  Identify Data Type - SYSTEM$TYPEOF   -  Part 97 Part 96 -  Row Last Updated - ROW_TIMESTAMP   -  Part 96 Part 95 -  Date and Time - INTERVAL   -  Part 95 Part 94 -  BOOLAND_AGG   -  Part 94 Part 93 -  MERGE ALL BY NAME   -  Part 93 Part 92 -  Stop or Cancel the Running Query   -  Part 92 Part 91 -  ARRAY UNNEST - FLATTEN   -  Part 91 Part 90 -  Replace the String - INSERT - STUFF  -  Part 90 Part 89 -  Form the DATE from Parts DATE_FROM_PARTS  -  Part 89 Part 88 -  Count of non-NULL records of the column using ILIKE  -  Part 88 Part 87 -  UTC Time - CONVERT TIMEZONE  -  Part 87 Part 86 -  Modulus/Modulo Function - Remainder  -  Part 86 Part 85 -  UNION ALL BY NAME  -  Part 85   Part 84 -  EXTRACT Day/Month/Year  -  Part 84 Part 83 -...

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