UFN_PROSPECT_VALIDMANAGERSTARTDATE
Validates that the start date of a prospect manager is after the end date of its previous managers.
Return
| Return Type |
|---|
| bit |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @PROSPECTID | uniqueidentifier | IN | |
| @MANAGERSTARTDATE | datetime | IN |
Definition
Copy
CREATE function dbo.UFN_PROSPECT_VALIDMANAGERSTARTDATE
(
@PROSPECTID uniqueidentifier,
@MANAGERSTARTDATE datetime
)
returns bit
with execute as caller
as begin
if exists (
select top 1
ID
from
dbo.PROSPECTMANAGERHISTORY
where
PROSPECTID = @PROSPECTID
and (
@MANAGERSTARTDATE is null
or DATETO > @MANAGERSTARTDATE
)
)
return 0;
return 1;
end