Solved

a filed included with another field ms sql

Posted on 2011-09-26
5
174 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

'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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

12 Experts available now in Live!

Get 1:1 Help Now