Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Data Type

Posted on 2004-04-11
8
Medium Priority
?
137 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 256 total points
ID: 10801452
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 248 total points
ID: 10802066
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
ID: 10802108
It is Microsoft Access
0
 
LVL 17

Assisted Solution

by:anandkp
anandkp earned 248 total points
ID: 10804228
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 248 total points
ID: 10808952
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses

972 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