Showing posts with label money. Show all posts
Showing posts with label money. Show all posts

Sunday, February 19, 2012

CCur

this document says that CCUR is supported in SSRS 2005; but I'm trying
to convert a float to money format-- so it gets 2 decimal places and a
dollar sign in front of it.
and i just can't get CCUR to work _AT_ALL_ in SSRS 2005.
http://msdn2.microsoft.com/en-us/library/ms157205.aspx
my actual code is
="The premium for your plan is " & Parameters!AdHoc_PremiumAmount.Value
& "."
I'm trying to do this:
="The premium for your plan is " &
CCUR(Parameters!AdHoc_PremiumAmount.Value) & "."
can anyone help me figure out what I'm doing wrong?
I've got to allow the end users to enter a premiumAmount as a
parameter; the possible datatypes are String, Integer, Float; etc...
I just want the end users to be able to enter 200 and then my CCUR
function should automagically convert it to '$ 200.00'
shouldnt these things just work out of the box?
-Aaronhello?
does anyone else concur?
I just wish that MS would start doing a decent job of keeping track of
things like this.
heres some helpful hints, microsoft
KEEP YOUR DATA IN A DATABASE INSTEAD OF 100,000 DIFFERENT COPIES OF
XML!
-Aaron
aaron.kempf@.gmail.com wrote:
> this document says that CCUR is supported in SSRS 2005; but I'm trying
> to convert a float to money format-- so it gets 2 decimal places and a
> dollar sign in front of it.
> and i just can't get CCUR to work _AT_ALL_ in SSRS 2005.
> http://msdn2.microsoft.com/en-us/library/ms157205.aspx
> my actual code is
> ="The premium for your plan is " & Parameters!AdHoc_PremiumAmount.Value
> & "."
> I'm trying to do this:
> ="The premium for your plan is " &
> CCUR(Parameters!AdHoc_PremiumAmount.Value) & "."
>
> can anyone help me figure out what I'm doing wrong?
> I've got to allow the end users to enter a premiumAmount as a
> parameter; the possible datatypes are String, Integer, Float; etc...
> I just want the end users to be able to enter 200 and then my CCUR
> function should automagically convert it to '$ 200.00'
> shouldnt these things just work out of the box?
> -Aaron|||yeah I need to do the same thing.. anyone have any ideas'
-Susie
On Oct 3, 5:19 pm, aaron.ke...@.gmail.com wrote:
> this document says that CCUR is supported in SSRS 2005; but I'm trying
> to convert a float to money format-- so it gets 2 decimal places and a
> dollar sign in front of it.
> and i just can't get CCUR to work _AT_ALL_ in SSRS 2005.
> http://msdn2.microsoft.com/en-us/library/ms157205.aspx
> my actual code is
> ="The premium for your plan is " & Parameters!AdHoc_PremiumAmount.Value
> & "."
> I'm trying to do this:
> ="The premium for your plan is " &
> CCUR(Parameters!AdHoc_PremiumAmount.Value) & "."
> can anyone help me figure out what I'm doing wrong?
> I've got to allow the end users to enter a premiumAmount as a
> parameter; the possible datatypes are String, Integer, Float; etc...
> I just want the end users to be able to enter 200 and then my CCUR
> function should automagically convert it to '$ 200.00'
> shouldnt these things just work out of the box?
> -Aaron

Sunday, February 12, 2012

cast or convert varchar to money/datetime

Hello,
I have a dataset that is all varchar with leading and
trailing spaces (comes from a mainframe). I import this
data to a table that is all varchar (using DTS). I then
insert it to a table that has the correct datatype fields,
but I have to perform a conversion. I have been using
Cast(ltrim(rtrim(colx)) As datetime)
Cast(ltrim(rtrim(colx)) As money)
I seem to be getting the correct data with datetime, and
with money I get like 306.6900. Am I supposed to get a $
symbol for money? Or just decimal? So is cast the
correct operator here or should I use convert? If
convert - how do I convert money?
Thanks,
RonThere is no reason to store the dollar sign with the numeric value, nor is
there a need to use the MONEY data type. In fact, this can cause problems.
See http://www.aspfaq.com/2503 which, among other things, describes reasons
to use DECIMAL in favor of MONEY/SMALLMONEY.
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
"Ron" <anonymous@.discussions.microsoft.com> wrote in message
news:0b3601c53611$48d3c830$a401280a@.phx.gbl...
> Hello,
> I have a dataset that is all varchar with leading and
> trailing spaces (comes from a mainframe). I import this
> data to a table that is all varchar (using DTS). I then
> insert it to a table that has the correct datatype fields,
> but I have to perform a conversion. I have been using
> Cast(ltrim(rtrim(colx)) As datetime)
> Cast(ltrim(rtrim(colx)) As money)
> I seem to be getting the correct data with datetime, and
> with money I get like 306.6900. Am I supposed to get a $
> symbol for money? Or just decimal? So is cast the
> correct operator here or should I use convert? If
> convert - how do I convert money?
> Thanks,
> Ron|||SQL Server stores data, not the presentation of data. The client application
is what is doing the
presentation of your data. for the money datatype, the values 306.6900 and 3
06.69 are the same.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Ron" <anonymous@.discussions.microsoft.com> wrote in message
news:0b3601c53611$48d3c830$a401280a@.phx.gbl...
> Hello,
> I have a dataset that is all varchar with leading and
> trailing spaces (comes from a mainframe). I import this
> data to a table that is all varchar (using DTS). I then
> insert it to a table that has the correct datatype fields,
> but I have to perform a conversion. I have been using
> Cast(ltrim(rtrim(colx)) As datetime)
> Cast(ltrim(rtrim(colx)) As money)
> I seem to be getting the correct data with datetime, and
> with money I get like 306.6900. Am I supposed to get a $
> symbol for money? Or just decimal? So is cast the
> correct operator here or should I use convert? If
> convert - how do I convert money?
> Thanks,
> Ron|||Ron,
[money] values are numbers. 306.6900 is a number. The $ symbol
is not part of a money value, but just something that may be part of the
display of a number. SQL Server can convert money values to
strings with $ or with commas, using CONVERT with format codes
(see CAST AND CONVERT in Books Online).
The type of Cast(whatever as money) will definitely be [money]. If
you want to be absolutely sure, try
select cast(whatever as money) as onlyColumn
into #checktype
then look at the table structure for #checktype.
Steve Kass
Drew University
Ron wrote:

>Hello,
>I have a dataset that is all varchar with leading and
>trailing spaces (comes from a mainframe). I import this
>data to a table that is all varchar (using DTS). I then
>insert it to a table that has the correct datatype fields,
>but I have to perform a conversion. I have been using
>Cast(ltrim(rtrim(colx)) As datetime)
>Cast(ltrim(rtrim(colx)) As money)
>I seem to be getting the correct data with datetime, and
>with money I get like 306.6900. Am I supposed to get a $
>symbol for money? Or just decimal? So is cast the
>correct operator here or should I use convert? If
>convert - how do I convert money?
>Thanks,
>Ron
>

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

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