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!

Using a variable within a wildcard

Status
Not open for further replies.

bmacbmac

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

This is a simple example of what I am trying to do. Is there a way to use the variable in a wildcard of my select statement?

Code:
declare @folder varchar(200)
set @folder = (select min(folder) from #folders)

select * from #tempimages where path like '%@folder%'
 
Code:
declare @folder varchar(200)
set @folder = (select min(folder) from #folders)

select * from #tempimages where path like '%' + @folder% + '%'
 
Hmm. i don't see an edit post button.
Code:
declare @folder varchar(200)
set @folder = (select min(folder) from #folders)

select * from #tempimages where path like '%' + @folder + '%'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top