As per the requirement what i understood, here is the code: you need to manipulate it somewhat as per your convinience:
Declare @count INT
DECLARE @finalOutput VARCHAR(30)
DECLARE @dotCount INT
DECLARE @result VARCHAR(40)
SET @dotCount = 1
SET @finalOutput = ''
SET @result = ''
SET @count = 0
WHILE @count <= LEN('123456789123')/3
BEGIN
IF @count = LEN('123456789123')/3
BEGIN
SET @finalOutput = SUBSTRING('123456789123',@dotCount,3)
END
ELSE
BEGIN
SET @finalOutput = SUBSTRING('123456789123',@dotCount,3) + '.'
END
SET @result = @result + @finalOutput
SET @dotCount = @dotCount + 3
SET @count = @count + 1
END
SET @result = SUBSTRING(@result, 1,LEN(@result) - 1)
PRINT (@result)
kshitij kumar
kshitij@krayknot.com
www.krayknot.com