Sunday, February 12, 2012

CAST Money ?

I have tried to use the following statement (SQL Server 2005) where XXX is a
numeric field but there is no $ sign appears.
CAST (XXX,Money)
In this way, I try to use '$' + CAST (XXX, varchar) and it is OK. Is there
any better way to handle it AND why the first statement doesn't work ?
Thanks
PeterPeter
No, but do you think there is only '$' on the earth?
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3Sw0%23YsHHA.1060@.TK2MSFTNGP06.phx.gbl...
>I have tried to use the following statement (SQL Server 2005) where XXX is
>a numeric field but there is no $ sign appears.
> CAST (XXX,Money)
> In this way, I try to use '$' + CAST (XXX, varchar) and it is OK. Is
> there any better way to handle it AND why the first statement doesn't work
> ?
> Thanks
> Peter
>|||Peter,
Hi
the answer is NO. The best thing is to format it at the client side
Regards
VT
Knowledge is power, share it...
http://oneplace4sql.blogspot.com/
"Peter" <Peter@.discussions.microsoft.com> wrote in message
news:O3Sw0%23YsHHA.1060@.TK2MSFTNGP06.phx.gbl...
>I have tried to use the following statement (SQL Server 2005) where XXX is
>a numeric field but there is no $ sign appears.
> CAST (XXX,Money)
> In this way, I try to use '$' + CAST (XXX, varchar) and it is OK. Is
> there any better way to handle it AND why the first statement doesn't work
> ?
> Thanks
> Peter
>|||>I have tried to use the following statement (SQL Server 2005) where XXX is
>a numeric field but there is no $ sign appears.
And why should it? Wouldn't the English be a little angry if they had to
then run REPLACE to put a pound symbol instead of a dollar sign?
--
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006

No comments:

Post a Comment