Skip to main content

Optional parameters in Stored Procedure


parameter Declaration

@ShipmentYear INT,
@PartNumber VARCHAR(50),
@SupplierId VARCHAR(50) = NULL,-- Optional parameter with default value NULL
@SerialNumber VARCHAR(50) = NULL,-- Optional parameter with default value NULL
@FromShipmentDate DATE = NULL,-- Optional parameter with default value NULL
@ToShipmentDate DATE = NULL-- Optional parameter with default value NULL
IN where Clause
WHERE
E.ShipmentAddedUser >= 1006 AND
    A.[Year] = @ShipmentYear AND
    C.PartNumber = @PartNumber AND
    (@SupplierId IS NULL OR A.SupplierCode = @SupplierId) AND
    (@SerialNumber IS NULL OR A.SerialNumber = @SerialNumber) AND
    (@FromShipmentDate IS NULL OR @ToShipmentDate IS NULL OR E.ShipmentDate BETWEEN @FromShipmentDate AND @ToShipmentDate);

Comments

Popular posts from this blog

Convex Lens Vs Concave Lens

What is a Lens A lens is a transparent object that transmits light across it, and its working principle depends on the   law of refraction (Snell’s law) . Applications: Concave Lens help with Far-Sight Convex Lens help with Near-Sight

Herbal Plants

Herbal plants to grow in home Different types of keerai ----- http://www.indiandietrecipes.com/2016/03/pictures-of-various-types-of-greens-or.html Pirandai ----good for bone joins---- https://youtu.be/k2DGubyXLAE Valarai Keerai Benifits ----- https://youtu.be/33HIfLJKTqA Sesma seeds ---- https://easyayurveda.com/2011/02/24/sesame-and-sesame-oil-benefits-total-ayurveda-details/

What is Verbal and Non-Verbal communication

TYPES OF COMMUNICATIONS: