Export (0) Print
Expand All

Converting money Data

SQL Server 2000

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:

SM_MONEY VARCHAR               
------------------------------ 
3148.29                        

(1 row(s) affected)

MONEY DECIMAL          
---------------------- 
3148                   

(1 row(s) affected)

See Also

CAST and CONVERT

Data Types

Show:
© 2015 Microsoft