Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Returning results without "n".

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-15 : 08:43:10
Brian writes "I'm sorry my title isn't the most descriptive, but hopefully someone will be able to help me out.

Okay, I have a table, tblAcctTrans, with, say, one field: AcctNum. Some of our older account numbers in AcctNum contain letters. Those are the ones we're trying to avoid. So, for example, I want my results to give these account numbers:

123458
234567

but not any account number with a letter in it:

123f45
s345d6

Any suggestions on what operator(s) to use and how to set it up in the query?

Thanks,

Brian"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-05-15 : 08:43:51
SELECT * FROM tblAcctTrans WHERE AcctNum NOT LIKE '%[^0-9]%'
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-05-15 : 10:14:42
SELECT * FROM tblAcctTrans
WHERE ISNUMERIC(AcctNum) = 1
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-15 : 11:25:32
quote:
Originally posted by Peso

SELECT * FROM tblAcctTrans
WHERE ISNUMERIC(AcctNum) = 1


ISNUMERIC is not reliable.

Read this
http://aspfaq.com/show.asp?id=2390

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -