Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Need Query Help To Identify VARCHAR Fields that only contain the charectors of zero thru nine (0-9)

Avatar of frogman22
frogman22 asked on
Oracle DatabaseMicrosoft SQL Server 2005
12 Comments1 Solution339 ViewsLast Modified:
I am working in SQL Server 2005 and am LINKED to an ORACLE database.

I need help writing a query that only returns what I am looking for. On the table I am quering there is a field called acct_nbr that is a varchar(25).  In that field there will be one of two types of entries. Type One - the field will only contain a value that consists of any combination of charecters of 0-9 and will always have a length of 9. Type two - The field will hold a value that has a combination of characters that consist of A-Z only.

I only want to return all records where the acct_nbr field contains charaters of only (0-9)

My current query returns results of:
record_num     acct_nbr
     1                123456789
     2                NNZ_XTYN

I only want to return record 1

This query does not work:
Select *
from openquery(db1,'
select *
from schema1.table_01
where acct_nbr like (''%0-9%'')