Link to home
Create AccountLog in
Avatar of pratikshahse
pratikshahse

asked on

Cast currency to a decimal in SQL server

i want to convert a currency field in a SQL server query to a decimal field

Select ISNULL( mrm_amt,0) AS OriginalMRMAmt from contract_rate.

In this query mrm_amt is a currency field and I want to cast it to a decimal. How do I do that?
ASKER CERTIFIED SOLUTION
Avatar of k_rasuri
k_rasuri

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of the_mickster
the_mickster

This should do the trick.

CAST(    "variable"  AS   decimal    )

If not use the CONVERT function in SQL.
if you want to use CONVERT function

SELECT ISNULL(CONVERT(DECIMAL, mrm_amt), 0) AS OriginalMRMAmt FROM contract_rate