Is there a way to write the following script so that it returns all products if the ProductID variable is null ? And return a specific product when the product it is not nul
Try this
DECLARE @productID INT = NULL SELECT ProductID, ProductName, ProductDesc FROM product WHERE ProductID = isnull(@productID,ProductID)