Possible Duplicate:
how to convert string into query in sql server
How to add string in which we have And clause. but when we apply that string which query this string will be treated as Query and fulfill all and conditions
I have a query like:-
Declare @WhereQuery varchar(max)
SET @WhereQuery='class=''BCA'' and RollNo=10 AND ID IN (SELECT ID FROM StudentMaster WHERE MARKS > 50)'
SELECT * into #TempTable1
from StudentMaster
where @WhereQuery
I also don't want to use execute or exec function to run this query