?
Solved

SQL LIKE function for table field not string literal

Posted on 2007-03-22
2
Medium Priority
?
190 Views
Last Modified: 2010-03-19
I am using SQL Server Express 2005.

I need to do a string compare in my query and it is something similar to:
ItemTexts.BookTitle LIKE '%Dictionary%'

In the above case I am checking for the existance of the string literal within the ItemTexts.BookTitle field.

However, instead of a string literal, the string to check is contained in another table field. But I obviously cannot do:
ItemTexts.BookTitle LIKE '%ItemCategories.LookupString%'

Can you explain how I can achieve the above bearing in mind it is between table fields?
0
Comment
Question by:mike99c
[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
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 18776961
ItemTexts.BookTitle LIKE '%'+ItemCategories.LookupString+'%'
0
 

Author Comment

by:mike99c
ID: 18777224
Great thanks, I should have known about the string concatenation.Nice easy 500 points for you.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

764 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