Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
skillile
Posting Yak Master
208 Posts |
Posted - 2002-02-14 : 09:02:28
|
| declare @search varchar(20)declare @sql varchar(2000)set @search='a'set @sql='select fname from tbluser where fname'--print @sqlexec(@sql)--how do I set this to dynamic sqlselect fname from tbluser where fname like '%' + @search + '%'--can I somehow set the @search to be = to % when no value is requested to--return all instead of a filtered view--ieselect fname from tbluser where fname like '%' + '%' + '%'slow down to move faster... |
|
|
lfmn
Posting Yak Master
141 Posts |
Posted - 2002-02-14 : 10:05:10
|
| use pubsdeclare @search varchar(20)declare @sql varchar(2000)set @search='w'set @sql='select au_fname from authors where au_lname like ''%' + @search + '%'''print @sqlexec(@sql)cursors are like hammers - sometimes you have to use them, but watch your thumb! |
 |
|
|
|
|
|