Friday, March 9, 2012

How can i insert a curreny formated column

Hi i have made a column that is called carprice. Instead of just typing in £500 i want to be able to put in 500 and then have sql auto format it to £500 in the column. In other words just put the £ price infront. Is there a way of doing this thanks.A currency value should be left as a number without any symbols. The client side code should be the one formatting the value with the appropriate currency symbol. DotNet has support for this type of thing for client side formatting.|||I agree, storing as a number is the best design. Later when you need to use that data in a calculation, you dont have to try and parse it and deal with invalid entries. But the downside to just having a number is that you have no idea what currency that number is in. So if your app has any possibilities of ever going global, you might consider having a second field to track the currency. You could have a dropdown that lists all the currencies you support. You could then case on the currency to do the formatting of the output of the value you stored as a number.

No comments:

Post a Comment