Converting money Data

When converting to money from integer data types, units are assumed to be in monetary units. For example, the integer value of 4 is converted to the money equivalent of 4 monetary units.

This example converts smallmoney and money values to varchar and decimal data types, respectively.

USE pubs

GO

DECLARE @mymoney_sm SMALLMONEY

SET  @mymoney_sm = 3148.29

SELECT  CAST(@mymoney_sm AS VARCHAR) AS "SM_MONEY VARCHAR"

GO

DECLARE @mymoney    MONEY

SET  @mymoney    = 3148.29

SELECT  CAST(@mymoney AS DECIMAL)    AS "MONEY DECIMAL"

GO

  

Here is the result set:

(1 row(s) affected)

  

SM_MONEY VARCHAR              

------------------------------

3148.29                       

  

(1 row(s) affected)

  

  

(1 row(s) affected)

  

MONEY DECIMAL         

----------------------

3148                  

  

(1 row(s) affected)

  

See Also
CAST and CONVERT Data Types

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.