Last post Dec 09, 2015 07:11 PM by limno
Dec 09, 2015 07:04 PM|sushsudh|LINK
Create a storedproc with 2 parameters c1,c2
Select * from table where a=@c1 and how to put a condition like if c2 is not supplied display all values of c2,if c2=1 display only that.
Dec 09, 2015 07:11 PM|limno|LINK
You can start with:
CREATE PROCEDURE testSP
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
Select * from yourtable
where a=@c1 and (b=@c2 or @c2 is null)