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
 SQL Server Development (2000)
 Finding alpha in field....

Author  Topic 

Dorffius
Starting Member

36 Posts

Posted - 2002-02-20 : 08:57:22
Here is my current code, but I need to have it return only records that have a letter in the ShipNum field. The letter could be at any point in the field or any letter for that matter.

SELECT VSHPITMS.SHIPDATE, VSHPITMS.PCODE, VSHPITMS.SHIPNUM, VSHPITMS.OBJECTS, ENAME FROM BAAN_SERVER.traypack_scale.dbo.SPROD SPROD INNER JOIN VSHPITMS ON VSHPITMS.PCODE = SPROD.PCODE WHERE VSHPITMS.SHIPDATE >= '" & startdate & "' AND VSHPITMS.SHIPDATE <= '" & endDate & "' ORDER BY SHIPDATE

Is there a specific function that could accomplish this?

Thanks in advance.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-20 : 09:00:21
A small addition to your WHERE clause will do it:

SELECT VSHPITMS.SHIPDATE, VSHPITMS.PCODE, VSHPITMS.SHIPNUM, VSHPITMS.OBJECTS, ENAME
FROM BAAN_SERVER.traypack_scale.dbo.SPROD SPROD INNER JOIN VSHPITMS ON VSHPITMS.PCODE = SPROD.PCODE
WHERE VSHPITMS.SHIPDATE >= '" & startdate & "' AND VSHPITMS.SHIPDATE <= '" & endDate & "'
AND VSHPITMS.SHIPNUM Like '%[a-z]%'
ORDER BY SHIPDATE


Like is a pattern-matching operation, and the pattern listed will find any alpha character in the string. Books Online has more details on Like.

Go to Top of Page

Dorffius
Starting Member

36 Posts

Posted - 2002-02-20 : 09:03:48
Thank you so much.

Go to Top of Page
   

- Advertisement -