Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 10-04-09   #1 (permalink)
Web Designer
 
ImmortalKenny's Avatar
 
amd ati

Join Date: Mar 2006
Location: Arizona
Posts: 6,144

Rep: 524 ImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famous
Unique Rep: 391
Hardware Reviews: 6
Trader Rating: 21
Default SQL Currency Conversion

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?

System: ImmortalPuter
CPU
AMD Phenom II X2 550
Motherboard
DFI LP JR 790GX-M3H5
Memory
OCZ Gold 4GB (2x2) DDR3-1600
Graphics Card
XFX 4890 XXX
Hard Drive
Seagate 300GB + 320GB External
Sound Card
Creative XtremeMusic
Power Supply
OCZ GameXStream 700w
Case
Antec Mini P180 (Black)
CPU cooling
Noctua NH-U12P, 2x Ultra Kaze 3k's
GPU cooling
Stock
OS
Windows 7 Pro x64
Monitor
Acer H233H 1080p
ImmortalKenny is offline Overclocked Account ImmortalKenny's Gallery   Reply With Quote
Old 10-04-09   #2 (permalink)
AMD Overclocker
 
cytrik's Avatar
 
amd ati

Join Date: Sep 2009
Location: Guatemala Currently
Posts: 138

Rep: 23 cytrik is acknowledged by some
Unique Rep: 23
Trader Rating: 0
Default

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
__________________
System: rockstar x
CPU
Phenom x4 9950 BE @ 3.0
Motherboard
MSI K9A2VM-F v2
Memory
Kingston 4GB DDR2 (2X2gb)
Graphics Card
VisionTek HD4670 @ 790/930
Hard Drive
500gb Samsung SATA / 500gb WD IDE / External 2x1TB
Sound Card
Integrated Realtek ALC888/ALC662
Power Supply
Antec SmartPower 2.0 SP-450 450W ATX12V
Case
Generic ATX
CPU cooling
stock
GPU cooling
stock
OS
Multiboot
Monitor
2 x Acer x223w 22" Wide

Last edited by cytrik : 10-04-09 at 08:15 PM
cytrik is offline   Reply With Quote
Old 10-04-09   #3 (permalink)
2 + 2 = 5
 
DuckieHo's Avatar
 
intel nvidia

Join Date: Nov 2006
Location: In a Chair.
Posts: 34,851

Rep: 4164 DuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guruDuckieHo is a guru
Unique Rep: 1903
Trader Rating: 56
Default

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


System: Three Dead Mobos in a Year
CPU
Q6600 (3.4GHz)
Motherboard
EVGA 780i
Memory
2x2GB OCZ Reaper 1096MHz
Graphics Card
GTX260 55nm
Hard Drive
PERC 6/i: 3xRAID0 7200.12 500GB
Sound Card
X-Fi XtremeMusic
Power Supply
Corsair 620HX
Case
Li Lian PC-V2100 [10x120mm fans]
CPU cooling
FuZion V2 + Quad-Heatercore
GPU cooling
EK Block + DDC-3.2
OS
Vista Ultimate 64
Monitor
Samsung 226BW "C" + Sceptre 19"
DuckieHo is offline Overclocked Account DuckieHo's Gallery   Reply With Quote
Old 10-05-09   #4 (permalink)
Web Designer
 
ImmortalKenny's Avatar
 
amd ati

Join Date: Mar 2006
Location: Arizona
Posts: 6,144

Rep: 524 ImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famousImmortalKenny is becoming famous
Unique Rep: 391
Hardware Reviews: 6
Trader Rating: 21
Default

It's for homework, but I'm going to school tomorrow to ask the professor.

System: ImmortalPuter
CPU
AMD Phenom II X2 550
Motherboard
DFI LP JR 790GX-M3H5
Memory
OCZ Gold 4GB (2x2) DDR3-1600
Graphics Card
XFX 4890 XXX
Hard Drive
Seagate 300GB + 320GB External
Sound Card
Creative XtremeMusic
Power Supply
OCZ GameXStream 700w
Case
Antec Mini P180 (Black)
CPU cooling
Noctua NH-U12P, 2x Ultra Kaze 3k's
GPU cooling
Stock
OS
Windows 7 Pro x64
Monitor
Acer H233H 1080p
ImmortalKenny is offline Overclocked Account ImmortalKenny's Gallery   Reply With Quote
Old 10-05-09   #5 (permalink)
PC Gamer
 
chemicalfan's Avatar
 
intel ati

Join Date: May 2008
Location: Portsmouth, UK
Posts: 1,376
Blog Entries: 3

Rep: 116 chemicalfan is acknowledged by manychemicalfan is acknowledged by many
Unique Rep: 90
Trader Rating: 0
Default

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
__________________
Intel Processor Finder - essential knowledge for OC'ers
OCCT - essential tool for OC'ers
Quote:
Originally Posted by Inuyasha1771
I hate it when they are like " LET'S WATCH A MOVIE >=3" and you're like "No, it's 6 PM, I just got off work, I need to overclock." and they can't relate. Give me a girl who overclocks, and I'll give you a miracle.

System: Black 'n' blue II
CPU
Core i7 860
Motherboard
MSI P55-GD60
Memory
4GB G.Skill Ripjaw
Graphics Card
Xpertvision Radeon HD4850
Hard Drive
150Gb Velociraptor & 250Gb Samsung
Sound Card
ESI Maya USB
Power Supply
Thermaltake Purepower RX 550
Case
Galaxy II
CPU cooling
Noctua NH-U12P SE2
GPU cooling
Stock
OS
Vista Home Premium x64
Monitor
Hyundai BlueH H224W 22" LCD
chemicalfan is offline   Reply With Quote
Old 10-05-09   #6 (permalink)
= Web Developer =
 
Microsis's Avatar
 
intel nvidia

Join Date: Apr 2008
Posts: 4,061

Rep: 480 Microsis is a proven memberMicrosis is a proven memberMicrosis is a proven memberMicrosis is a proven memberMicrosis is a proven member
Unique Rep: 337
Hardware Reviews: 1
Trader Rating: 8
Default

As everyone states, it's good practice to store data as simply as possible then format it on output.
1 Million+ Folding at Home points
Microsis is offline Overclocked Account   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 06:02 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.11373 seconds with 8 queries