user2520291
user2520291

Reputation: 253

UPDATE with NOT LIKE Operator

UPDATE Table
    SET Table.[Field] = 'DUMMY' WHERE Table.[Acct Numb] not like 
( '*01'. '*03'. '*04'. '*07'. '*08'. '*09');

Can I use NOT LIKE operator using update query? I am using MS ACCESS for execution of this query.

Thanks

Upvotes: 2

Views: 204

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1270391

You can use not like, but not with a list:

UPDATE Table
    SET Table.[Field] = 'DUMMY'
    WHERE Table.[Acct Numb] not like '*01' and
          Table.[Acct Numb] not like '*03' and
          Table.[Acct Numb] not like '*04' and
          Table.[Acct Numb] not like '*07' and
          Table.[Acct Numb] not like '*08' and
          Table.[Acct Numb] not like '*09';

You can also right this as:

update table
     SET Table.[Field] = 'DUMMY'
     where right(Table.[Acct Numb], 2) not in ( '01'. '03'. '04'. '07'. '08'. '09')

Upvotes: 3

Phill
Phill

Reputation: 18804

Based on the MS reference for access, and as @Alex K suggested

http://office.microsoft.com/en-sg/access-help/access-wildcard-character-reference-HP005188185.aspx

You should be able to do:

UPDATE Table
    SET Table.[Field] = 'DUMMY'
    WHERE Table.[Acct Numb] not like '*0[134789]'

Upvotes: 1

Related Questions