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
 Transact-SQL (2000)
 Inserting blanks for readability in numbers

Author  Topic 

Johnyalm
Starting Member

49 Posts

Posted - 2005-05-27 : 06:33:20
I would like to convert (or insert blanks) numbers for readability like this example:

1000000.99 shall go like this 1 000 000.99

This is only for readability - its for sure easier to read and interpret the million in the converted way!

Is there a good way to do this?



www.mirrorgate.com

Johnyalm
Starting Member

49 Posts

Posted - 2005-05-27 : 06:35:42
I would like to do this in a function so that the server can deliver floats as string formatted in the way i described.

www.mirrorgate.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-27 : 06:51:49
If possible do it in the presentation layer.
If you use VB6, then
format(number,"# ### ###.00")

Madhivanan

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

Johnyalm
Starting Member

49 Posts

Posted - 2005-05-27 : 10:05:39
Sorry, maybee it is not possibly beacuse we use a semilanguage that we do not have control over so it cannot be done in the presentation layer, has to be done in the query !

www.mirrorgate.com
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-05-27 : 10:16:31
would this work for you?
declare @var money
set @var = 1000000.99
select convert(varchar(50), @var, 1)


Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-05-27 : 10:49:46
Yes, it will work. To have space use this

select replace(convert(varchar(50), @var, 1),',',' ')

Madhivanan

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

- Advertisement -