Gutanoth
Gutanoth

Reputation: 842

Updating a table in MS_Access using SQL

I have a few databases and I need to insert a string value in front of some of the values. I have the following code:

UPDATE DB_AlarmTest SET DB_AlarmTest.Address = "DB40," & [Address]
WHERE DB_AlarmTest.Address 
NOT LIKE '%DB40%';

I dont want my adresses to come out like this: "DB40,DB40,DB40,2.0" If i execute the query more than once, so I added the " NOT LIKE '%DB40%' " part

Can someone tell my why this is not working?

Thanks in advance!

Upvotes: 1

Views: 47

Answers (1)

Fionnuala
Fionnuala

Reputation: 91376

With the usual ANSI options in MS Access, the wildcard is *, not %, so:

UPDATE DB_AlarmTest 
SET DB_AlarmTest.Address = "DB40," & [Address]
WHERE DB_AlarmTest.Address Not Like "*DB40*"

Upvotes: 2

Related Questions