Cast currency to a decimal in SQL server

pratikshahse
pratikshahse used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
select ISNULL(CAST(mrm_ant as decimal), 0) AS OriginalMRMAmt FROM contract_rate
This should do the trick.

CAST(    "variable"  AS   decimal    )

If not use the CONVERT function in SQL.

Commented:
if you want to use CONVERT function

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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial