Solved

Data Type

Posted on 2004-04-11
8
124 Views
Last Modified: 2013-12-24
Hi,
  I was wondering if I stored currency in my database as a Text Field, for instance the data can be 5.00 or $5.00 or simply 5, how do I add $10 to that field?

Nick
0
Comment
Question by:SolverSurfer
8 Comments
 
LVL 10

Accepted Solution

by:
Mause earned 64 total points
Comment Utility
Hi,

Difficult if its only a number it would be easy by just do 5 + 10 but if you also store the $ you must first remove it before you can add something to it. It would sugest not to store the currency value in the same field

Mause
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 62 total points
Comment Utility
You may be able to store it as text and then do a conversion on the data before you do the addition and then convert back to save it - this could all be done int he one DB call.

what kind of database do you have? - I am guessing access in which case there are not as many DB side functions supported

It is probably best to try to store any numeric values that you will need to be manipulating as a numeric type (currency, float, double, etc)
0
 

Author Comment

by:SolverSurfer
Comment Utility
It is Microsoft Access
0
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 62 total points
Comment Utility
Store it as a number "data type"

& while displaying use "dollarformat()" to get the $

Once u have it as a number data type in Database - adding 10 to it wld be

Update table set currency_column = currency_column + 10
0
 
LVL 17

Assisted Solution

by:Tacobell777
Tacobell777 earned 62 total points
Comment Utility
Store it as currency like it should be stored, it is currency so use the datatype currency.
To get the $ sign you could use lsCurrencyFormat() or dollarFormat()
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now