insert char into string at multiple positions sql
One more way using STUFF()
DECLARE @a varchar(64)
SET @a = '99999999999999999'
SELECT STUFF(STUFF(STUFF(STUFF(@a, 4, 0, '-'), 10, 0, '-'), 13, 0, '-'), 18, 0, '.')
You need to use SUBSTRING:
SELECT
SUBSTRING(account, 1, 3) + '-' +
SUBSTRING(account, 4, 5) + '-' +
SUBSTRING(account, 9, 2) + '-' +
SUBSTRING(account, 11, 4) + '.' +
SUBSTRING(account, 15, 3)