SQL SERVER – Interesting Observation with Currency Symbols

The currency symbols like $ and £ are implicitly treated as money value in SQL Server

If you run the following code

SELECT $

SELECT £

You can see that both of the above statements return the value 0.00

SQL SERVER - Interesting Observation with Currency Symbols currency1

It is also possible to use them in arithmetic calculations

SELECT $+5

returns 5.00

SELECT 45-£

returns 45.00

SQL SERVER - Interesting Observation with Currency Symbols currency2

How many of you know this?

Reference: Pinal Dave (https://blog.sqlauthority.com)

Previous Post
Interview Question of the Week #011 – Script to Convert List to Table and Table to List
Next Post
SQL SERVER – Marking Filegroup as ReadOnly with SQL Server

Related Posts

No results found.

2 Comments. Leave new

  • I had no idea. I have to try it tomorrow

    Reply
  • SHAHNAWAZ CHISHTY
    January 28, 2019 3:55 pm

    ANY PROVISION TO SAVE EURO SYMBOL IN DATABASE, THOUGH WE ARE UNABLE TO UPDATE THE COLUMN TO NVARCHAR AS UPDATION IN PRODUCTION DATA MAY CAUSE DATA LOSS

    Reply

Leave a Reply

Menu