Posts

Showing posts with the label #dataengineer #HappyReading

Snowflake Vs MS-SQL - Part 77 - Remove Duplicates From String

Image
           Remove Duplicates From String Suppose you have a string that contains values separated by a delimiter, and you have to remove those duplicates. -- Actual String 'A, B, C, a, b' -- Expected String 'A, B, C' MS-SQL Server   We can achieve it by using functions like  STRING_AGG & STRING_SPLIT : In  Snowflake,  we can use a similar approach by using  LISTAGG & SPLIT_TO_TABLE,  as below For more details, refer to  LISTAGG  &  SPLIT_TO_TABLE . Yogesh Shinde LinkedInProfile <<< Back   Next >>>   

Snowflake Vs MS-SQL - Part 76 - COLLATE - Comparing Text Strings

Image
           COLLATE - Comparing Text Strings Suppose you want to compare the string using case sensitivity. When  comparing " HELLO " with " hello ", it should not  match. MS-SQL Server    We can achieve it by using different collation SQL_LATIN1_GENERAL_CP1_CS_AS : However, in  Snowflake,  we can use a similar approach by using  COLLATE,  as below: Note: CS used here for case-sensitive. For case-insensitive, you can use CI. For more details, you can refer:  COLLATE . Yogesh Shinde LinkedInProfile <<< Back   Next >>>  

Snowflake Vs MS-SQL - Part 74 - Convert Column Into Comma Separated

Image
          Convert Column Into Comma-Separated If you have data in a table and you want to convert columnar data into a comma-separated string. Current Data: Expected Data: MS-SQL Server   We can achieve it by anyone approaching below: However, in  Snowflake,  we can use two ARRAY functions,  ARRAY_AGG & ARRAY_TO_STRING,  as below: For more details, you can refer to:  ARRAY_AGG  &  ARRAY_TO_STRING . Yogesh Shinde LinkedInProfile <<< Back   Next >>>