Export (0) Print
Expand All

Using Monetary Data

SQL Server 2000

Microsoft® SQL Server™ stores monetary data (currency values) using two data types: money and smallmoney. These data types can use any one of the following currency symbols.

Currency or monetary data does not need to be enclosed in single quotation marks ('). However, the monetary data value must be preceded by the appropriate currency symbol. For example, to specify 100 English pounds, use £100.

money and smallmoney are limited to four decimal points. Use the decimal data type if more decimal points are required.

Use a period to separate partial monetary units, like cents, from whole monetary units. For example, 2.15 specifies 2 dollars and 15 cents.

Comma separators are not allowed in money or smallmoney constants, although the display format of these data types includes comma separators. You can specify the comma separators only in character strings explicitly cast to money or smallmoney, for example:

USE Northwind
GO
CREATE TABLE TestMoney (cola INT PRIMARY KEY, colb MONEY)
GO
SET NOCOUNT ON
GO

-- The following three INSERT statements work.
INSERT INTO TestMoney VALUES (1, $123.45)
GO
INSERT INTO TestMoney VALUES (2, $123123.45)
GO
INSERT INTO TestMoney VALUES (3, CAST('$444,123.45' AS MONEY) )
GO

-- This INSERT statement gets an error because of the comma
-- separator in the money string.
INSERT INTO TestMoney VALUES (3, $555,123.45)
GO
SET NOCOUNT OFF
GO
SELECT * FROM TestMoney
GO 

See Also

Data Types

Monetary Data

money and smallmoney

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft