Collections:
CONCAT_WS() - Concatenation with Separator
How to concatenate multiple strings together with a given separator using the CONCAT_WS() function?
✍: FYIcenter.com
CONCAT_WS(separator, string1, string2, ...) is a MySQL built-in function that concatenates
multiple strings together. For example:
SET @host = 'dba';
SET @domain = 'FYIcenter';
SET @tld = 'com';
SELECT CONCAT_WS('.', @host, @domain, @tld);
-- +--------------------------------------+
-- | CONCAT_WS('.', @host, @domain, @tld) |
-- +--------------------------------------+
-- | dba.FYIcenter.com |
-- +--------------------------------------+
Reference information of the CONCAT_WS() function:
CONCAT_WS(separator, str1, str2, ...): str Returns the string that results from concatenating the arguments except for the first one, which is used as concatenation separator, like the CONCAT() function. If the separator is NULL, the result is NULL. Arguments, return value and availability: separator: Required. The given separator. str1: Required. The first given string to concatenate for. str2: Optional. The second given string to concatenate for. str: Return value. The string of concatenation of all given strings. Available since MySQL 4.0.
Related MySQL functions:
⇒ CONV() - Binary/HEX String and Integer Conversion
⇐ CONCAT() - Concatenating Strings
2023-11-10, 1071🔥, 0💬
Popular Posts:
How To Use "IF ... ELSE IF ..." Statement Structures in SQL Server Transact-SQL? "IF ... ELSE IF ......
How To Disable a Login Name in SQL Server? If you want temporarily disable a login name, you can use...
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...