
sql - How do I split a delimited string so I can access individual ...
Nov 2, 2015 · More on split functions, why (and proof that) while loops and recursive CTEs don't scale, and better alternatives, if splitting strings coming from the application layer: Split strings the right way – or the next best way; Splitting Strings : A Follow-Up; Splitting Strings : Now with less T-SQL; Comparing string splitting / concatenation methods
Grouped string aggregation / LISTAGG for SQL Server
May 8, 2017 · If it is SQL Server 2017 or SQL Server VNext, Azure SQL database you can use String_agg as below: SELECT make.CarMakeId, make.CarMake, CarModels = string_agg(model.CarModel, ', ') FROM CarModels model INNER JOIN CarMakes make ON model.CarMakeId = make.CarMakeId GROUP BY make.CarMakeId, make.CarMake Output:
Use '=' or LIKE to compare strings in SQL? - Stack Overflow
Feb 5, 2009 · There's a couple of other tricks that Postgres offers for string matching (if that happens to be your DB): ILIKE, which is a case insensitive LIKE match: select * from people where name ilike 'JOHN' Matches: John; john; JOHN; And if you want to get really mad you can use regular expressions: select * from people where name ~ 'John.*' Matches ...
SQL Server: Make all UPPER case to Proper Case/Title Case
Oct 26, 2015 · Borrowed and improved on @Richard Sayakanit answer. This handles multiple words. Like his answer, this doesn't use any UDFs, only built-in functions (STRING_SPLIT and STRING_AGG) and it's pretty fast. STRING_AGG requires SQL Server 2017 but you can always use the STUFF/XML trick. Won't handle every exception but can work great for many ...
How to use GROUP BY to concatenate strings in SQL Server?
Eight years later... Microsoft SQL Server vNext Database Engine has finally enhanced Transact-SQL to directly support grouped string concatenation. The Community Technical Preview version 1.0 added the STRING_AGG function and CTP 1.1 added the WITHIN GROUP clause for the STRING_AGG function.
Building SQL strings in Access/VBA - Stack Overflow
Apr 13, 2015 · Here's the code for one I use for creating a query string for an HTTP GET: Public Sub AppendQueryString(strInput As String, _ ByVal strAppend As String, Optional ByVal strOperator As String = "&") strAppend = StringReplace(strAppend, "&", "&") strInput = strInput & strOperator & strAppend End Sub
SQL Pivot with String - Stack Overflow
Apr 25, 2012 · I have two tables in SQL Server: Customer and Address Customer Table: CustomerID FirstName LastName ----------- ---------- ---------- 1 Andrew Jackson 2 George ...
Databricks SQL string_agg - Stack Overflow
Nov 18, 2021 · This would fall under a new feature request. You can handle basic SQL functions only link. Note: Databricks SQL provides a simple experience for SQL users who want to run quick ad-hoc queries on their data lake, create multiple visualization types to explore query results from different perspectives, and build and share dashboards.
Entity framework EF.Functions.Like vs string.Contains
Aug 16, 2017 · For example .StartsWith gets translated as (string LIKE pattern + "%" AND CHARINDEX(pattern, string) = 1) OR pattern = '' where .Contains gets translated into (CHARINDEX(pattern, string) > 0) OR pattern = ''. EF.Functions.Like however gets translated into string LIKE pattern [ESCAPE escapeChar]. This may also have implications on Performance.
sql - Optimal way to concatenate/aggregate strings - Stack Overflow
They have implimented STRING_AGG() in Azure SQL Database as well. That should provide the exact functionality originally requested in this post with native and built in support. @hrobky mentioned this previously as a SQL Server 2016 feature at the time.