Solved

SQL format of number

Posted on 2011-03-09
5
942 Views
Last Modified: 2012-05-11
I have a field Fiscal Year that returns the year as 2,009.  How do I in my SQL remove the , from the 2,009 value?
0
Comment
Question by:garyjgs
5 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 35084939
try

select substr(year, 1,1) || substr(year,3,3)
from your_tbale
0
 
LVL 18

Accepted Solution

by:
daveslash earned 500 total points
ID: 35085087

It's probably easiest to just convert it to a varchar.

e.g.

select varchar(theValue) as theYear
  from deleteme

THEYEAR
2009

Open in new window

0
 
LVL 45

Expert Comment

by:Kdo
ID: 35085470

Hi Gary,

If the value '2,000' is stored in the table, momi's suggestion works fine.

I prefer the replace() function though.


  SELECT replace (TheYear, ',', '') FROM mytable;


Good Luck,
Kent
0
 

Author Closing Comment

by:garyjgs
ID: 35086079
Worked as suggested.  Thanks.
0
 

Author Comment

by:garyjgs
ID: 35086084
Worked as suggested. Thanks.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now