Jumat, 21 Oktober 2011

[MS_AccessPros] Strange result of query

 

Hi,
I have a text field for Employee ID that is all numeric about 85% of the time. I wrote a query to give me all of the IDs that start with a specific number sequence:

SELECT * FROM tblEmployee WHERE EmployeeID LIKE '009*'

and got no results. I KNOW there are employees that start like that because everyone working in a certain business unit starts with that code.

So I changed it to:
SELECT * FROM tblEmployee WHERE EmployeeID LIKE '*009*'

(notice I surrounded the string with *)

And got the results I wanted. Every Employee ID has 009 as the left 3 characters if they are in a specific BU, so why didn't the first one return any results? The field is formatted as text on the table. I trimmed the field and tried the original again but to no avail.

Thanks
-Lee

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar