[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

SQL LIKE function for table field not string literal

Posted on 2007-03-22
2
Medium Priority
?
191 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

649 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