all groups > sql server programming > august 2003 >
You're in the

sql server programming

group:

Change 1299.99 to 1,299.99


Re: Change 1299.99 to 1,299.99 Vishal Parkar
8/30/2003 7:52:39 AM
sql server programming:
Try:
declare @x decimal(10,2)
select @x= 1299.99
select convert(varchar,cast(@x as money),1)

--
-Vishal

[quoted text, click to view]

Re: Change 1299.99 to 1,299.99 Bob Barrows
8/30/2003 9:50:08 AM
[quoted text, click to view]

Numbers don't have format. Strings do. So use the CONVERT function to
convert the number to a string using the appropriate Style argument which
can be found in BOL (I think it's "1") to specify the comma-separated
format. Like this:

declare @n int
set @n=10000000
select CONVERT(varchar(10),@n,1)

HTH,
Bob Barrows

Change 1299.99 to 1,299.99 Ericsson
8/30/2003 9:36:52 PM
Hi All,

Please kindly tell me how to change the number to a format with comma in
store procedure of transact sql.

Thanks in advance.

Ericsson

AddThis Social Bookmark Button