dbo.fn_ms_find_item_in_move_avg_id

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Null on Null Input

False

Schema Bound

False

Assembly

Parameters

Name Data Type Length Description
(Result) bigint 8
@business_date date 3
@ms_item_id bigint 8

SQL Script

SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE FUNCTION dbo.fn_ms_find_item_in_move_avg_id (@business_date date , @ms_item_id bigint)
RETURNS bigint
WITH EXECUTE AS CALLER 
AS
BEGIN  
return (isnull((SELECT  top(1)      dt_ms_item_daily_in_move_avg.ms_item_in_move_avg_id
      FROM            dt_ms_item_daily_in_move_avg INNER JOIN
             dt_ms_date_business ON dt_ms_item_daily_in_move_avg.ms_date_business_id = dt_ms_date_business.ms_date_business_id
      WHERE        (dt_ms_date_business.ms_date_business = @business_date) AND (dt_ms_item_daily_in_move_avg.ms_item_id = @ms_item_id)
      ) ,-1) )
END
GO