Solved

a filed included with another field ms sql

Posted on 2011-09-26
5
175 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:robrodp
  • 3
  • 2
5 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 36601502
+ is the concatenation operator in SQL. & is a bitwise operator.
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 36601507
In other words,
select * from table where field1 like '%' + field2 + '%';

Open in new window

0
 

Author Comment

by:robrodp
ID: 36601529
It returns just those records where field1=field2
0
 

Author Comment

by:robrodp
ID: 36601546
One record field1='James Bond' field2='Bond'


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

returns nothing

select * where field1 like '%Bond%'

returns the record????
0
 

Author Closing Comment

by:robrodp
ID: 36601571
Thx
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now