CONCAT function ignores NULLs: SELECT CONCAT(LEFT(LastName, 1), ‘,’ , LEFT(FirstName, 1), ‘ ‘ + LEFT(MiddleName, 1)) theNameWithInitials FROM myTable If you use CONCAT, you will not need to worry about whether LEFT(X) is null or not.
Tag: concat
String Interpolation, String Format, String Concat and String Builder in C#
We will try to return a string like: “I can text whatever I want with 4 different options in C#. ” with String Interpolation, String Format, String Concat, and String Builder. public class StringOptions { private string data1 = “4”; private string data2 = “C#”; public string StringInterpolation() => ($”I can text whatever I want […]
SQL Server CONCAT_WS Function (Concat with Separator)
The SQL Server CONCAT_WS() function concatenates two or more strings into one string with a separator. CONCAT_WS() means concatenate with separator.