|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Yikes! SQL Money Formatting - Where's the Comma?
Hi, I'm using SQl Server 2000 and I have some data stored in MONEY format that I'd like to display via an XML web report. While the data itself comes up properly, itmis not formatted with commas separating the millions, thousands, and hundreds. MSDN says that this formatting is based on regional settings. My settings are:
- SERVER: Reginal Settings set to US English, with all desired number formatting - CLIENT: Reginal Settings set to US English, with all desired number formatting. ODBC settings have option "Use regional settings to display numbers, dates, etc." checked. Why do I still not get my precious commas? Is there a way to override this? Thanks! |
|
#2
|
|||
|
|||
|
RE: Yikes! SQL Money Formatting - Where's the Comma?
I think what you need to take a look at is PHP's number_format function.
http://www.php.net/manual/en/function.number-format.php Basically what you'll probably want to do is take your money data (I'll call it $money), and run it through the function something like: The 2 tells the function how many numbers after the decimal, the . is the decimal separator, and the , is the thousands seperator. Hope this helps. Dave |
|
#3
|
|||
|
|||
|
RE: Yikes! SQL Money Formatting - Where's the Comma?
You can use the convert function on the money data type and have it use regional options...this assumes a column of amount and a table called test.
select convert(varchar(12),amount,1) from test |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Yikes! SQL Money Formatting - Where's the Comma? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|