Drawbacks of Dynamic Query in Sqlserver 2005 ?

Posted by KuldipMCA on Stack Overflow See other posts from Stack Overflow or by KuldipMCA
Published on 2010-05-11T07:17:27Z Indexed on 2010/05/11 7:24 UTC
Read the original article Hit count: 264

I have using the many dynamic Query in my database for the procedures because my filter is not fix so i have taken @filter as parameter and pass in the procedure.

Declare @query as varchar(8000)
Declare @Filter as varchar(1000)

set @query = 'Select * from Person.Address where 1=1 and ' + @Filter

exec(@query)

Like that my filter contain any Field from the table for comparison.

It will affect my performance or not ? is there any alternate way to achieve this type of things

© Stack Overflow or respective owner

Related posts about sql

Related posts about stored-procedures