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
Loading
Pankaj RanaPosted Dec 11, 2011, 12:53 AM
CREATE PROCEDURE getlettestoffer(@offerid int)