Home Forums SQL Server 2008 T-SQL (SS2K8) How to pass where condition as parameter of stored procedure RE: How to pass where condition as parameter of stored procedure

  • I agree with Sergei is that it is best not to do it. That being said, there are ways to pass the where clause to a SP.

    One way that comes to mind is to great a Sp with a large varchar input parameter. This parameter would be used to pass in your where clause.

    In the Sp you then would have to use dynamic sql and build you sql statement and execute it.

    It is not very pretty and opens up the possibility of SQL injection attacks and chances of errors.

    Dave