Difference between revisions of "Dbo.ufnGetStock (function)"
(New page: == wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''function | dbo.ufnGetStock |- |} <pre> CREATE FUNCTION [dbo].[ufnGetStock](@ProductID...) |
|||
| Line 27: | Line 27: | ||
END; | END; | ||
</pre> | </pre> | ||
| + | |||
| + | == automatically generated == | ||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- | ||
| + | | '''function | ||
| + | | dbo.ufnGetStock | ||
| + | |- | ||
| + | |||
| + | | '''Description | ||
| + | | Scalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID. | ||
| + | |- | ||
| + | |||
| + | |} | ||
| + | |||
| + | <pre> | ||
| + | |||
| + | CREATE FUNCTION [dbo].[ufnGetStock](@ProductID [int]) | ||
| + | RETURNS [int] | ||
| + | AS | ||
| + | -- Returns the stock level for the product. This function is used internally only | ||
| + | BEGIN | ||
| + | DECLARE @ret int; | ||
| + | |||
| + | SELECT @ret = SUM(p.[Quantity]) | ||
| + | FROM [Production].[ProductInventory] p | ||
| + | WHERE p.[ProductID] = @ProductID | ||
| + | AND p.[LocationID] = '6'; -- Only look at inventory in the misc storage | ||
| + | |||
| + | IF (@ret IS NULL) | ||
| + | SET @ret = 0 | ||
| + | |||
| + | RETURN @ret | ||
| + | END; | ||
| + | </pre> | ||
| + | |||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- style="background:silver" | ||
| + | | '''Referenced Object | ||
| + | | '''Object Type | ||
| + | | '''Dependency Type | ||
| + | |||
| + | |- | ||
| + | | [[Production.ProductInventory_(table)|Production.ProductInventory]] | ||
| + | | Table | ||
| + | | Select | ||
| + | |} | ||
Revision as of 23:59, 26 November 2009
wikibot
| function | dbo.ufnGetStock |
CREATE FUNCTION [dbo].[ufnGetStock](@ProductID [int])
RETURNS [int]
AS
-- Returns the stock level for the product. This function is used internally only
BEGIN
DECLARE @ret int;
SELECT @ret = SUM(p.[Quantity])
FROM [Production].[ProductInventory] p
WHERE p.[ProductID] = @ProductID
AND p.[LocationID] = '6'; -- Only look at inventory in the misc storage
IF (@ret IS NULL)
SET @ret = 0
RETURN @ret
END;
automatically generated
| function | dbo.ufnGetStock |
| Description | Scalar function returning the quantity of inventory in LocationID 6 (Miscellaneous Storage)for a specified ProductID. |
CREATE FUNCTION [dbo].[ufnGetStock](@ProductID [int])
RETURNS [int]
AS
-- Returns the stock level for the product. This function is used internally only
BEGIN
DECLARE @ret int;
SELECT @ret = SUM(p.[Quantity])
FROM [Production].[ProductInventory] p
WHERE p.[ProductID] = @ProductID
AND p.[LocationID] = '6'; -- Only look at inventory in the misc storage
IF (@ret IS NULL)
SET @ret = 0
RETURN @ret
END;
| Referenced Object | Object Type | Dependency Type |
| Production.ProductInventory | Table | Select |