Saturday, February 25, 2012

removing decimal points

All,
I need to take a datatype money and remove the decimal point.
Any suggestions? All of the Casts and Converts seem to remove the
decimal places or leave the decimal point.
ex.
I need to take 1234.56 and output 123456
thanks...One way
declare @.m money
select @.m =1234.56
select replace(convert(varchar(30),@.m),'.','')
Denis the SQL Menace
http://sqlservercode.blogspot.com/
aaonms@.gmail.com wrote:
> All,
> I need to take a datatype money and remove the decimal point.
> Any suggestions? All of the Casts and Converts seem to remove the
> decimal places or leave the decimal point.
> ex.
> I need to take 1234.56 and output 123456
> thanks...|||That worked perfectly, thanks...
SQL Menace wrote:
> One way
> declare @.m money
> select @.m =1234.56
> select replace(convert(varchar(30),@.m),'.','')
> Denis the SQL Menace
> http://sqlservercode.blogspot.com/
>
> aaonms@.gmail.com wrote:|||aaonms@.gmail.com wrote:
> All,
> I need to take a datatype money and remove the decimal point.
> Any suggestions? All of the Casts and Converts seem to remove the
> decimal places or leave the decimal point.
> ex.
> I need to take 1234.56 and output 123456
> thanks...
>
DECLARE @.Amount MONEY
SELECT @.Amount = 1234.56
SELECT CONVERT(INT, @.Amount * 100)
Tracy McKibben
MCDBA
http://www.realsqlguy.com

No comments:

Post a Comment