|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
SQL Currency Conversion
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Web Designer
![]() |
Basically there is a column called "Retail" and the numbers are formatted like "39.95." How do I add a dollar sign in front of the data to make it like "$39.95" and apply it to the whole column?
__________________
|
|||||||||||||
|
|
|
|
#2 (permalink) | |||||||||||||
|
AMD Overclocker
Join Date: Sep 2009
Location: Guatemala Currently
Posts: 138
Rep: 23
![]() Unique Rep: 23
Trader Rating: 0
|
normally you wouldn't store symbols in tables, it is preferable you do this via PHP output, if it's for a website, do you absolutely need it in tables?
__________________the other problem with this is, PHP or other interpreters would take the $ for string or whatever it stands for in the language pulling the info and parsing it
Last edited by cytrik : 10-04-09 at 08:15 PM |
|||||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
2 + 2 = 5
![]()
Join Date: Nov 2006
Location: In a Chair.
Posts: 34,851
Rep: 4164
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Unique Rep: 1903
Trader Rating: 56
|
Store it as float and format it when you display it.
__________________
To answer most of your questions: (1) a fridge cannot cool a PC (2) 64-bit OS for over 3.4GB (3) If a PCIe card fits, it should work (4) Resolution, not screen size (5) If you have a question, it is not news (6) Report, not respond to Spam (7) Single-Rail/Non-Modular PSUs are not always better than Multi-Rail/Modular
|
|||||||||||||
|
|
|
|
#4 (permalink) | |||||||||||||
|
Web Designer
![]() |
It's for homework, but I'm going to school tomorrow to ask the professor.
__________________
|
|||||||||||||
|
|
|
|
#5 (permalink) | ||||||||||||||
|
PC Gamer
![]() |
If you want to store it in the table, you've have to change the type of the column to from number to varchar - I wouldn't do this if I were you, or you could run into all sorts of trouble later when you attempt to use the data as a number.
When you run your SELECT statement later to get the detail out, you can add the symbol in then. Or, you could create a view with the symbol in - this is probably the best plan thinking about it, because you can convert the column to varchar in the view and it won't make any different to the table
__________________
Quote:
|
||||||||||||||
|
|
|
|
|
#6 (permalink) |
|
= Web Developer =
![]() |
As everyone states, it's good practice to store data as simply as possible then format it on output.
__________________
FOR SALE: | Modded CM690 | OCZ 700W PSU | WD 36GB Raptor | Tuniq Tower 120 *Lapped* The 750i FTW Overclock Thread The 55nm GTX 260 216 Overclock Thread BC2 > MW2
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|