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!

SQL Query to Check partial string value

Status
Not open for further replies.
Sep 29, 2002
524
0
0
US
Ok. I thought I could pick this up and do some simple queries but I guess it takes a genius :p - so lets ask the experts … :)

I am trying to do a query that selects or records that a field do not have a value equal to '%WORKSTATIONS' in other words anything that is NULL or anything that does not end in the WORSTATIONS word. Well, I am creating the following

select *
From table
where table.field not like '%WORKSTATIONS'

But the query seems to be giving me every like '%WORKSTATIONS'

I think that the reason may be because the content is as follows:

1 "one/", "one", "one/two/department WORKSTAIONS"
2 "one/", "one"
3

How can I search gives me record 2 and 3 instead of 1?

Thanks for your help,



Gladys Rodriguez
GlobalStrata Solutions
 
Try this:
Code:
select *
From table
where table.field not like '%WORKSTATIONS%'

OR

select *
From table
where Rtrim(table.field) not like '%WORKSTATIONS'
 
Unfortunately, it does not work. However, if I put

select *
From table
where table.field like '%WORKSTATIONS%'

It works fine (the way is supposed to).

Any other suggestions?


Gladys Rodriguez
GlobalStrata Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top