Skip to content
Advertisement

Tag: string

Concat rows for employee roles

I’m using SQL Server. Looking for similar functionality as GROUP_CONCAT or listagg functions provided in other Databases. Seems like STUFF function is provided to concat rows. Here’s my attempt. Employee Role EmployeeRole Expected Output Answer In SQLServer 2017, you can use aggregate function STRING_AGG(): Note: table aliases make the query more concise and easier to read. I modified the query

Find the count of words in string

SQL: How to find the count of words in following example? Subquestions: How to count spaces? How to count double/triple/… spaces as one? answer by Gordon Linoff here How to avoid counting of special characters? Example: ‘Please , don’t count this comma’ Is it possible without string_split function (because it’s available only since SQL SERVER 2016)? Summary with the best

Extract a specific value from a string in a column

Need help with a situation, I need to extract a specific value from a column containing string. The string varies over different records, but the value I need to extract is always preceded by the word “VERSION” I tried to user REVERSE & SUBSTRING but not able to get exact results. Any help will be greatly appreciated the table looks

Advertisement