1

I am looking to put a comma after two digits from right. For example i have 250$ and in SQL I want the select to return 2,50$. Example2: 500$ should be 5.00$. For 1000$. It should be 10,00$. How can it be done in select. I have a column that holds those value in my SQL database. Thanks you in advance for your help. My column data type is bigint

Blessed
  • 55
  • 6
  • 1
    Keep in mind Display value vs stored value. Don't store more than you have to. – xQbert Apr 07 '17 at 20:23
  • Check out http://stackoverflow.com/questions/11854775/sql-server-convert-date-to-string-mm-dd-yyyy/11854877#11854877 – TFD Apr 07 '17 at 20:27
  • Which DBMS are you using? Postgres? Oracle? –  Apr 07 '17 at 20:46

1 Answers1

0

Ironically, you can do this the same way in almost any database:

select cast( (col / 100.0) as decimal(20, 2))
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
  • Wow, Thanks million... your syntaxe resolved my issue.................. – Blessed Apr 10 '17 at 13:06
  • I was solving my issue in the way that was very complicated but here you gave me an easy answer i never thought about. Thanks Gordon Linoff – Blessed Apr 10 '17 at 13:07