SQL MONEY Data Type

The MONEY data type holds monetary or currency values.

MONEY accepts values from -922,337,203,685,477.5808 to 922,337,203,685,477.5807.

A period is used to separate partial from whole monetary units like cents.

Example

#

A table with a MONEY column.

CREATE TABLE DemoTable  
( 
  Id INT IDENTITY, 
  Painting VARCHAR(100),
  Artist VARCHAR(100),
  Price MONEY
);
GO  

INSERT INTO DemoTable VALUES ('Salvator Mundi', 'Leonardo da Vinci', 450300000);  
INSERT INTO DemoTable VALUES ('Pendant Portraits of Maerten Soolmans and Oopjen Coppit', 'Rembrandt van Rijn', 195000000);  
INSERT INTO DemoTable VALUES ('Portrait of a Young Man Holding a Roundel', 'Sandro Botticelli', 92200000);
INSERT INTO DemoTable VALUES ('Massacre of the Innocents', 'Peter Paul Rubens', 76500000); 
INSERT INTO DemoTable VALUES ('Lot and His Daughters', 'Peter Paul Rubens', 58200000); 
GO  

SELECT * FROM DemoTable;
GO

DROP TABLE DemoTable;
GO
Result:  5 records
Id Painting Artist Price
1 Salvator Mundi Leonardo da Vinci 450300000.00
2 Pendant Portraits of Maerten Soolmans and Oopjen Coppit Rembrandt van Rijn 195000000.00
3 Portrait of a Young Man Holding a Roundel Sandro Botticelli 92200000.00
4 Massacre of the Innocents Peter Paul Rubens 76500000.00
5 Lot and His Daughters Peter Paul Rubens 58200000.00

More Examples

MONEY with OTHER MONETARY TYPES

This example displays the maximum values for SMALLMONEY and MONEY.
CREATE TABLE DemoTable  
( 
  MySmallMoney SMALLMONEY,
  MyMoney MONEY
);
GO  

INSERT INTO DemoTable VALUES (214748.3647, 922337203685477.5807);  
GO  

SELECT * FROM DemoTable;
GO

DROP TABLE DemoTable;
GO
Result:  1 record
MySmallMoney MyMoney
214748.3647 922337203685477.5807

You may also like



Guides


vsn 3.1