Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find where word from one column exists in string of a different column

Status
Not open for further replies.

bmacbmac

IS-IT--Management
Jan 26, 2006
392
US
Hi,

I have the following table

create #temp (folder varchar(20), itexists varchar(1))

I would like to set the itexists folder = 'x'
where folder is in a string from another column of another database... something like this..

update #temp
set itexists = 'x'
where folder in (select imagepath from mytable2)

However the imagepath will be a long string. I just want to know if the single word in [folder] exists in [imagepath]

 
try this:

Code:
update #temp
set itexists = 'x'
where exists(Select 1 from mytable2 where imagepath like '%' + folder + '%')



-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top