Convert Stored Procedure In to CASE STATEMENT Which is in IF ELSE
I want to Covert that Stored Procedure In Case Statement On in If Else
Please Help Me
CREATE PROCEDURE getlettestoffer(@offerid int)
As
Begin
Declare @offer varchar(50)
Select @offer=ImagePath from Offers where OfferID=@offerid
if @offer IS NOT NULL
Begin
Select TOP(10) Products.ProductID,Offers.OfferID,Offers.OfferTitle,Products.timestamp
from Products INNER JOIN Offers ON Products.ProductID=Offers.ProductID
where Offers.ImagePath is Not NULL order by timestamp desc
End
Else
Begin
Select TOP(10) Products.ProductID,Offers.OfferID,Offers.OfferTitle,Products.timestamp
from Products INNER JOIN Offers ON Products.ProductID=Offers.ProductID
order by timestamp desc
End
End
Any one help me to write this stored Procedure in case statement not in if Else statement