Solved

SQL LIKE function for table field not string literal

Posted on 2007-03-22
2
182 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
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
Comment Utility
ItemTexts.BookTitle LIKE '%'+ItemCategories.LookupString+'%'
0
 

Author Comment

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

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

772 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

11 Experts available now in Live!

Get 1:1 Help Now