• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 990
  • Last Modified:

SQL format of number

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
garyjgs
Asked:
garyjgs
1 Solution
 
momi_sabagCommented:
try

select substr(year, 1,1) || substr(year,3,3)
from your_tbale
0
 
Dave FordSoftware Developer / Database AdministratorCommented:

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
 
Kent OlsenData Warehouse Architect / DBACommented:

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
 
garyjgsAuthor Commented:
Worked as suggested.  Thanks.
0
 
garyjgsAuthor Commented:
Worked as suggested. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now