Hi,
Try This...Actually the problem is You are comparing VARCHAR Values like 'Bangalore' and all without single Quote.
DECLARE @SQLQuery VARCHAR(3000), @conditions VARCHAR(1000)
SELECT @conditions= 'customerid=7 and address=CHAR(39)+bangalore+CHAR(39) and phone=9988776655'
SELECT @SQLQuery='select * from tbl_customer where '+@conditions
PRINT @SQLQuery
EXEC(@SQLQuery)
Check the following links...Answers or search in Code project articles.
http://www.codeproject.com/script/Answers/Post.aspx?aid=597000[
^]
Regards,
GVPrabu