37 lines
883 B
Transact-SQL
37 lines
883 B
Transact-SQL
USE [FabApprovalSystem]
|
|
GO
|
|
/****** Object: UserDefinedFunction [dbo].[fnGetLotCount_RH_MA] Script Date: 11/21/2024 11:31:55 AM ******/
|
|
SET
|
|
ANSI_NULLS ON
|
|
GO
|
|
SET
|
|
QUOTED_IDENTIFIER ON
|
|
GO
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[fnGetLotCount_RH_MA] (
|
|
-- Add the parameters for the function here
|
|
@IssueID INT
|
|
) RETURNS FLOAT AS BEGIN DECLARE @QDBCount INT -- Declare the return variable here
|
|
SET
|
|
@QDBCount = 0
|
|
SET
|
|
@QDBCount = (
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
LotDisposition LD
|
|
INNER JOIN Lot L ON LD.IssueID = L.IssueID
|
|
WHERE
|
|
(
|
|
L.ProductFamily = 'RH'
|
|
OR L.ProductFamily = 'MA'
|
|
)
|
|
AND LD.IssueID = @IssueID
|
|
) -- Return the result of the function
|
|
RETURN @QDBCount
|
|
END
|
|
GO |