UFN_PROSPECT_VALIDMANAGERSTARTDATE_2
Validates that the start date of a prospect manager is after the end date of its previous managers.
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PROSPECTID | uniqueidentifier | IN | |
@MANAGERSTARTDATE | datetime | IN |
Definition
Copy
create function dbo.UFN_PROSPECT_VALIDMANAGERSTARTDATE_2
(
@PROSPECTID uniqueidentifier,
@MANAGERSTARTDATE datetime
)
returns table
as
return
select
coalesce
(
(
select top 1
0
from
dbo.PROSPECTMANAGERHISTORY
where
PROSPECTID = @PROSPECTID and
(@MANAGERSTARTDATE is null or DATETO > @MANAGERSTARTDATE)
),
1
) as VALID