Most of the questions regarding string concatenation in SQL server is asked in scope of concatenation of multiple rows. However, this is a bit different - say you have N variables @str1, @str2, @str3... @strN to join.
How would one efficiently concatenate them using a delimiter?
Example:
DECLARE
@str1 nvarchar(60),
@str2 nvarchar(60),
@str3 nvarchar(60),
@str4 nvarchar(60),
@str5 nvarchar(60),
@strJoint nvarchar(max)
SELECT
@str1 = 'A',
@str2 = 'B',
@str3 = 'C',
@str4 = 'D',
@str5 = 'E'
-- This does not exist out of the box
SELECT @strJoint = STRINGJOIN(';', @str1, @str2, @str3, @str4, @str5)
-- @strJoint should be 'A;B;C;D;E'