Solved

SQL LIKE function for table field not string literal

Posted on 2007-03-22
2
189 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 500 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

707 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