SQL Query - Need Urgent Help
I have a stored procedure which has a query [static] for which I need to append one variable [dyanamic] so that it is executed when SP is run.
Declare @WhereCondition Varchar(500)
SET @WhereCondition = 'where id between 1 and 10'
"Select * from Some_Table" is my query
I want to append @WhereCondition to the above query in such a way that, when it is run the query should run like
"Select * from Some_Table Where id between 1 and 10"
PS: I dont want to use dynamic queries as my SP has got 100s of queries which will be a difficult task to change the entire procedure.
Kindly Help ASAP.
My Sincere Thanks well in advance. Thanks for your Valuable Time
Last edited by astrosathya; November 10th, 2010 at 04:17 AM..