What is the data type to the currency value in SQL Server.
e.g: I want to store $11.23
.
Can I use money type and addtionally will it store the $
symbol?
DECLARE @Price Decimal(18,2) = 11.23
SELECT FORMAT(@Price,'c','en-US') AS 'CURRENCY IN US Culture'
answering to the question in the title, the datatype for currency is MONEY
.
the money
datatype will store the information only, without the format: in your example the information is 11.23
so that's what is saved into the database.
the $
sign is part of the format so it will not be stored into the money
field.
the usual solution is to have a MONEY
field for the amount and a VARCHAR
field for the currency symbol/name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With