set @strSQL='select * from testtable AS P WHERE P.Type='+@PType+' and P.PName ='''+@PName+''' and P.PCode='+@PCode+' '; -- like ''%'+@PName+'%'' ' ;