Solved

Data Type

Posted on 2004-04-11
8
129 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
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 62 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 62 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 62 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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