If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > convert numbers in SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-19-06, 09:59
ahmed_zedan ahmed_zedan is offline
Registered User
 
Join Date: Dec 2004
Posts: 11
convert numbers in SQL

how can i format numbers in SQL
Eg. i have number such as 1250.000002341 in a table [money].[Paid]
how can i fornat that number to 125,00?
Reply With Quote
  #2 (permalink)  
Old 01-20-06, 02:55
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
With the number stored in "money.paid", use
Code:
CAST(money.paid AS DECIMAL(10,2))
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #3 (permalink)  
Old 01-20-06, 03:08
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
formatting is usually a function of your user interface. So its rare to come accross a requirement like this in SQL. Where are you using this information - in a report, in a screen, in a text file?
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On