Hi Gail,
I have changed my one stored procedure. As you have the code block which I posted. Now that block will look like this:
IF @inbCityID IS NOT NULL AND @inbCityID > 0
BEGIN
SET @SqlCondition = @SqlCondition + N' AND vaa.CityID = @inbCityID';
END
I have just one question. When I will call the sp_executesql & will pass the parameters, Can I pass all parameters (approx 14) regardless of query.
Means in above code block, if @inbCityID is 0 then above condition will not be included in our final sql string. Can I pass my all parameters (including @inbCityID) because we don't know that this condition will become true or false.
I have checked by executing the procedure (& passed all parameters) where only one condition was true, SP is running without any error.
I have just asked because of any performance consideration. Is there any performance impact if I pass more parameters. I have included all parameters in params definition. I googled but didn't find any answer, that's why I am asking.