user2335482
user2335482

Reputation: 1

What is wrong with the query?

I'm implementing this query with asp.net in VB, the objective of that query is to sort out the email data other than @yahoo.com and @gmail.com, it shows an error :

Incorrect syntax near '@yahoo' and '@gmail".

"select * from print_venue where not (email_id like %" & "@yahoo.com" & "%) AND (email_id like %" & "@gmail.com" & "%)"

What's wrong with the above query ?

Upvotes: 0

Views: 75

Answers (1)

juergen d
juergen d

Reputation: 204894

You forgot the quotes around the like statement

"select * from print_venue 
where not (email_id like '%" & "@yahoo.com" & "%') 
AND (email_id like '%" & "@gmail.com" & "%')"

It has to be

email_id like '%@yahoo.com%'

and not

email_id like %@yahoo.com%

Upvotes: 4

Related Questions