Solved

a filed included with another field ms sql

Posted on 2011-09-26
5
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 60

Expert Comment

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

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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

724 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