Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
select name, dbo.FormatNumber(id, 0)
from master.dbo.sysobjects
CREATE Function FormatNumber
(@RawNumber numeric(32,2) = 0,
@ShowDecimal as bit = 0
)
returns varchar(200) AS
BEGIN
declare @FormattedNumber as varchar(100)
declare @AfterDecimal as varchar(100)
declare @i as int
declare @j as int
set @i = 0
set @j = 0
set @FormattedNumber = convert(bigint, @RawNumber)
set @AfterDecimal = @RawNumber
if charindex('.', @AfterDecimal) <> 0
BEGIN
set @AfterDecimal = '.' + right(@AfterDecimal, len(@AfterDecimal)-charindex('.', @AfterDecimal))
END
ELSE
BEGIN
set @AfterDecimal = ''
END
while @i <> len(@FormattedNumber)
BEGIN
if @j = 3
BEGIN
set @j = -1
set @FormattedNumber = left(@FormattedNumber, len(@FormattedNumber)-@i) + ',' + right(@FormattedNumber, @i)
END
set @j = @j + 1
set @i = @i + 1
END
if @ShowDecimal <> 0
set @FormattedNumber = @FormattedNumber + @AfterDecimal
return @FormattedNumber
END