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 2005 Forums
 Transact-SQL (2005)
 Money Format Type xxx.xxx,yy

Author  Topic 

bilencekic
Posting Yak Master

121 Posts

Posted - 2009-11-13 : 07:52:19
Hi,
i use,
select convert(varchar, Convert(money, @MONEY_STRING), 1) as formattedAmount

but it formats like , 123,123,123.12
but i need, 123.123.123,12
is there an option set globalization values ? like
set dateformat dmy ?

MS BLESS US

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-11-13 : 07:57:18
Can you not put a replace at the beginning

REPLACE(convert(varchar, Convert(money, @MONEY_STRING), 1),'.',',')
Go to Top of Page

bilencekic
Posting Yak Master

121 Posts

Posted - 2009-11-13 : 07:59:35
ok it will be like
123.123.123.123
so how to replace last one ? :=)
there is an option,
replace "." with "a" and
replace "," with "b"
then
replace "b" with "." and
replace "a" with ","

but isn't there a short way?

MS BLESS US
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-13 : 08:03:19
You should do that in your front end application.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-13 : 08:06:57
quote:
Originally posted by bilencekic

Hi,
i use,
select convert(varchar, Convert(money, @MONEY_STRING), 1) as formattedAmount

but it formats like , 123,123,123.12
but i need, 123.123.123,12
is there an option set globalization values ? like
set dateformat dmy ?

MS BLESS US


Where do you want to show the formatted values?

Madhivanan

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

bilencekic
Posting Yak Master

121 Posts

Posted - 2009-11-13 : 08:10:36
i am converting and insterting to an other database's table.
if you say, "c'mon nigga! wtf mothe' fucke', it is imposibble"
and i will let other programmer to do it on frontend application, but i dont prefer it.

MS BLESS US
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-13 : 08:20:21
First: we would never say something like this.
Second: If you're going to copy those values into another table it would be a good idea to have the right data type for that column.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-13 : 08:21:40
I mean that a table should always use the right data type and any formatting for display is to do in front end.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

bilencekic
Posting Yak Master

121 Posts

Posted - 2009-11-13 : 08:52:51
first: ok then, but would you say ;
" Well, to tell you the truth, in all this excitement I kind of lost track myself. But being as this is a .44 Magnum, the most powerful handgun in the world, and would blow your head clean off, you've got to ask yourself one question: Do I feel lucky? Well, do ya, punk? "
ehehe joke :=)

second:
ok;
but the column is char formatted and it stores the HTML codes inside.
i though to format the data while inserting the table and show the correct format but it seems there is not an easy way like format(value,type).

my whole code was;
 
set @MIKTAR_S = [bold](select convert(varchar, Convert(money, @MIKTAR_S), 1) as formattedAmount)[/bold]
insert ##result_html values ('<td>' + @ACKLM + '</td>')
insert ##result_html values ('<td align=right><span style="color: ''#3399FF''">' + isnull(cast(@MIKTAR_S as varchar),0) + '</span></td>')
insert ##result_html values ('<td> <span style="color: ''#000000''">' + @BIRIM + '</span></td>')




third:
thx all :=)




MS BLESS US
Go to Top of Page
   

- Advertisement -