[thelist] SProcs - SELECT queries

Chris at globet.com Chris at globet.com
Thu Jun 23 12:19:30 CDT 2005


Brian

[..]

> set @querystring = 'SELECT aField, bField, cField, dField FROM aTable 
> WHERE 1=1 '
> 
> 	if(@bcondition1 is not null)
> 	begin
> 		set @querystring = @querystring + 'AND aField = 
> @aValue '
> 	end

[..]

> exec (@queryString)

That was exactly what I was looking to do. Many thanks!

[..]

Regards

Chris Marsh


More information about the thelist mailing list