Z
Zack Godula
I have the following stored procedure which features input parameters that
are retrieved from a form and then the resulting records are displayed on a
report:
ALTER PROCEDURE quality_user.SP_NCR_Details
(@StartDate datetime,
@EndDate datetime,
@Inspector varchar (50) = NULL)
AS
IF @Inspector IS NULL -- return all records
SELECT NCR, Issued_Date, Qty_Rejected, Disposition, Item, Item_Desc,
Project, Task, NC_Type, RootCause, System_Element, Location, Discrete_Job,
App_Code, PO_Number, PO_Line, Supplier_Number,
Where_Rejected, Oper_rej, Where_Occurred, NC_Source, ORG_BusinessUnit,
ORG_FunctionalArea, Supplier_Site, Inspector, Stock,
NCR_Close_Date
FROM dbo.V_NCR_Details
WHERE (Issued_Date BETWEEN @StartDate AND @EndDate)
ORDER BY NCR
ELSE -- return selected record
SELECT NCR, Issued_Date, Qty_Rejected, Disposition, Item, Item_Desc,
Project, Task, NC_Type, RootCause, System_Element, Location, Discrete_Job,
App_Code, PO_Number, PO_Line, Supplier_Number,
Where_Rejected, Oper_rej, Where_Occurred, NC_Source, ORG_BusinessUnit,
ORG_FunctionalArea, Supplier_Site, Inspector, Stock,
NCR_Close_Date
FROM dbo.V_NCR_Details
WHERE (Issued_Date BETWEEN @StartDate AND @EndDate) AND (Inspector =
@Inspector)
ORDER BY NCR
Currently I have three input parameters, but there are 8 combo boxes on my
form. The combo boxes will not always have values in them, except for the
start and end date combos. I would like to set up the input parameters so
that if no value is selected in the combo box, the stored procedures will
show all records for that field. The other combo boxes that I have include:
NC_Source, ORG_BusinessUnit, ORG_Functional Area, Project and Task.
Thank you in advance and let me know if you require any further information.
are retrieved from a form and then the resulting records are displayed on a
report:
ALTER PROCEDURE quality_user.SP_NCR_Details
(@StartDate datetime,
@EndDate datetime,
@Inspector varchar (50) = NULL)
AS
IF @Inspector IS NULL -- return all records
SELECT NCR, Issued_Date, Qty_Rejected, Disposition, Item, Item_Desc,
Project, Task, NC_Type, RootCause, System_Element, Location, Discrete_Job,
App_Code, PO_Number, PO_Line, Supplier_Number,
Where_Rejected, Oper_rej, Where_Occurred, NC_Source, ORG_BusinessUnit,
ORG_FunctionalArea, Supplier_Site, Inspector, Stock,
NCR_Close_Date
FROM dbo.V_NCR_Details
WHERE (Issued_Date BETWEEN @StartDate AND @EndDate)
ORDER BY NCR
ELSE -- return selected record
SELECT NCR, Issued_Date, Qty_Rejected, Disposition, Item, Item_Desc,
Project, Task, NC_Type, RootCause, System_Element, Location, Discrete_Job,
App_Code, PO_Number, PO_Line, Supplier_Number,
Where_Rejected, Oper_rej, Where_Occurred, NC_Source, ORG_BusinessUnit,
ORG_FunctionalArea, Supplier_Site, Inspector, Stock,
NCR_Close_Date
FROM dbo.V_NCR_Details
WHERE (Issued_Date BETWEEN @StartDate AND @EndDate) AND (Inspector =
@Inspector)
ORDER BY NCR
Currently I have three input parameters, but there are 8 combo boxes on my
form. The combo boxes will not always have values in them, except for the
start and end date combos. I would like to set up the input parameters so
that if no value is selected in the combo box, the stored procedures will
show all records for that field. The other combo boxes that I have include:
NC_Source, ORG_BusinessUnit, ORG_Functional Area, Project and Task.
Thank you in advance and let me know if you require any further information.