Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi


I would like to know how would i be able to change the format of the money column in SQL Server.

Currently on my database the money column is showing as 1234,56

I would like it to be 1234.56

any idea how i could change this?
Posted

You should not address this task on sql level. In version 2012 you have the possibility to use culture specific formatting (see MSDN[^]), but before that you can only solve this by string manipulation, which might look good at first sight, but is a bad idea, because this should be a concern of the presentation layer (user interface, reporting tool, whatever...), not of the data store.

But if you stick to this approach, start here: http://sqlusa.com/bestpractices2005/moneyformat/[^]. Beside the possibilities demonstrated there you can also make CLR integrated function for this task. This is a sample for DateTime formating, but it is quite easily adaptable to your needs: http://sqlsteve.com/2009/05/13/sql-server-datetime-format-function/[^].
 
Share this answer
 
SQL
ALTER TABLE table_name
ALTER COLUMN column_name datatype
 
Share this answer
 
Comments
Zoltán Zörgő 12-Nov-13 2:39am    
What has data type to do with data formatting?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900