| Property | Value |
|---|---|
| Name | ufnGetProductStandardCost |
| ID | 39671189 |
| Schema | dbo |
| Owner | dbo |
| Execute As | Caller |
| Type | SQL SCALAR FUNCTION |
| Uses Ansi Nulls |
|
| Uses Quoted Identifier |
|
| Is Schema Bound |
|
| Uses Database Collation |
|
| Null on Null Input |
|
| Encrypted |
|
| MS Shipped |
|
| Published |
|
| Schema Published |
|
| Deterministic |
|
| Precise |
|
| System Verified |
|
| System Data Access |
|
| User Data Access |
|
| Modify Date | 8/8/2010 5:23:46 PM |
| Creation Date | 8/8/2010 5:23:46 PM |
| Name | Value |
|---|---|
| MS_Description | Scalar function returning the standard cost for a given product on a particular order date. |
| Parameter Name | Datatype | Has Default Value | Default Value | Read Only | Xml Document | Description |
|---|---|---|---|---|---|---|
| @ProductID | int |
|
|
|
Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid ProductID from the Production.Product table. | |
| @OrderDate | datetime |
|
|
|
Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid order date. |
| Datatype | Has Default Value | Default Value | Xml Document | Description |
|---|---|---|---|---|
| money |
|
|
| Script |
|---|
| SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON CREATE FUNCTION [dbo].[ufnGetProductStandardCost](@ProductID [int], @OrderDate [datetime]) RETURNS [money] AS BEGIN DECLARE @StandardCost money; SELECT @StandardCost = pch.[StandardCost] FROM [Production].[Product] p INNER JOIN [Production].[ProductCostHistory] pch ON p.[ProductID] = pch.[ProductID] AND p.[ProductID] = @ProductID AND @OrderDate BETWEEN pch.[StartDate] AND COALESCE(pch.[EndDate], CONVERT(datetime, '99991231', 112)); -- Make sure we get all the prices! RETURN @StandardCost; END; EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid ProductID from the Production.Product table.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'FUNCTION',@level1name=N'ufnGetProductStandardCost', @level2type=N'PARAMETER',@level2name=N'@ProductID' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Input parameter for the scalar function ufnGetProductStandardCost. Enter a valid order date.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'FUNCTION',@level1name=N'ufnGetProductStandardCost', @level2type=N'PARAMETER',@level2name=N'@OrderDate' EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Scalar function returning the standard cost for a given product on a particular order date.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'FUNCTION',@level1name=N'ufnGetProductStandardCost' |