Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter by numeric in select 1

Status
Not open for further replies.

monkle

Programmer
Feb 11, 2004
132
0
0
US
I am writing a script that requires everything from a varchar column where the data is purely numeric, and I'm not sure the best way to go about this. I could write it into the script to ignore any data that contains non-numeric characters, but there would be less strain on the system if no invalid data even made it to the script.

Is there a way to create a select statement that will filter out any rows in a column that contains non-numeric data? Any input would be greatly appreciated.
 
Code:
select yourfield
from yourtable
where isnumeric(yourfield) = 1

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
Awesome, thank you. I have had a hard time finding a fully comprehensive SQL reference. Can you point me in the right direction?
 
You should make the BOL your friend. It is where you should start looking for solutions.

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine
or online at:

-SQLBill

Posting advice: FAQ481-4875
 
Thank you for the reference link. I will add that to the top of the list next time I run into an SQL issue.
 
Thanks
For your help, I accomplished what I was looking for.

Thank you so much
Raul
 
sereleg,

Did you post in the correct forum/thread?

-SQLBill

Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top