a filed included with another field ms sql

I have a table with 2 fields field1 and field2 both are char fields

I would like a where:

select * from table where field1 like '%' & field2 & '%'

I just does not work
Who is Participating?
Kevin CrossConnect With a Mentor Chief Technology OfficerCommented:
In other words,
select * from table where field1 like '%' + field2 + '%';

Open in new window

Kevin CrossChief Technology OfficerCommented:
+ is the concatenation operator in SQL. & is a bitwise operator.
robrodpAuthor Commented:
It returns just those records where field1=field2
robrodpAuthor Commented:
One record field1='James Bond' field2='Bond'

select * where field1 like '%' + field2 + '%'

returns nothing

select * where field1 like '%Bond%'

returns the record????
robrodpAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.