January 23, 2020 at 6:15 pm
Hello Please help me (how to modify a character string in sql server 2017)
the question is to convert the number 021548798 to 02.15.48.79.89
thank you
January 23, 2020 at 6:30 pm
Hello Please help me (how to modify a character string in sql server 2017)
the question is to convert the number 021548798 to 02.15.48.79.89
thank you
Where does the 9 in the final 89 come from?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
January 23, 2020 at 6:40 pm
execuse me it is 0215487989 to 02.15.48.79.89
it's the same chain
January 23, 2020 at 7:08 pm
execuse me it is 0215487989 to 02.15.48.79.89
it's the same chain
You need to get STUFFing:
DECLARE @x VARCHAR(20) = '0215487989';
SELECT @x
,Result = STUFF(STUFF(STUFF(STUFF(@x, 3, 0, '.'), 6, 0, '.'), 9, 0, '.'), 12, 0, '.');
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply