Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Display Money Data Type with $ and Comma Separator

Author  Topic 

BigJim_Jax
Starting Member

3 Posts

Posted - 2005-06-09 : 08:09:12
Seems like the simplest questions, but I need a way to display a money data type field in the format:

$ 999,999,990.00

Specifically when returning the results in query analyzer from a simple select query. I am familiar with casting the field to a string to get the 0.00, but don't know how to format the field with $ and comma separators.

Any help is greatly appreciated. BigJim

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-09 : 08:13:48
declare @m money
set @m= 999999990
select '$ ' +convert(varchar(20),@m,1)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-06-09 : 08:23:26
Note: this is usually worried about on the front end and not at a development tool level.

Jim
Users <> Logic
Go to Top of Page

BigJim_Jax
Starting Member

3 Posts

Posted - 2005-06-09 : 08:43:03
quote:
Originally posted by JimL

Note: this is usually worried about on the front end and not at a development tool level.

Jim
Users <> Logic



Agreed, and usually I would prefer it be handled this way; however, the end result of this is to be utilized in a DTS export to an external vendor whom I do not massaging the data.

Developer seemed to be the best forum for this since we usually are the people who deal with the presentational level.
Go to Top of Page

BigJim_Jax
Starting Member

3 Posts

Posted - 2005-06-09 : 08:47:17
quote:
Originally posted by madhivanan

declare @m money
set @m= 999999990
select '$ ' +convert(varchar(20),@m,1)


Madhivanan

Failing to plan is Planning to fail



Perfect Madhivanan, worked like a charm!

Thank You!!!!
Go to Top of Page
   

- Advertisement -