[thelist] To Store or Not to Store - Building dynamic queries
Casey Crookston
caseyc at IntelliSoftmn.com
Mon Aug 14 15:34:10 CDT 2006
Hmm, I didn't finish this off very well. Trynig again...
CREATE proc PROCNAME
(
@param1 type(x)
@param2 type(x)
)
as
begin
declare @whereString varchar(8000)
declare @queryString varchar(8000)
if @param1 > ''
begin
set @whereString = 'xxxxxx LIKE @param1'
end
if @param2 > ''
begin
set @whereString = @whereString + 'AND zzzzzz LIKE @param2 '
end
set @queryString = 'SELECT * FROM table WHERE " + @whereString
exec(@queryString)
end
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list