There is a piece of code from stored procedure.
I want to put a condition in this:
If scode = 'p' then
where condition must be like this:
WHERE
(pi.pid = @pid or @pid is NULL)
AND
((pi.scode = @scode and pi.scode ='p' ) or @scode is NULL)
Please tell me how to modify the code?
thks
Code:
BEGIN SET NOCOUNT ON; SELECT pi.* FROM rates pi WHERE (pi.pid = @pid or @pid is NULL) AND (pi.scode = @scode or @scode is NULL) END
If scode = 'p' then
where condition must be like this:
WHERE
(pi.pid = @pid or @pid is NULL)
AND
((pi.scode = @scode and pi.scode ='p' ) or @scode is NULL)
Please tell me how to modify the code?
thks
Comment