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