UFN_PROSPECTMANAGERHISTORY_VALIDENDDATE
Validates that the end date of the historical prospect manager is after the start and end date of the current prospect manager.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PROSPECTID | uniqueidentifier | IN | |
@DATETO | datetime | IN |
Definition
Copy
create function dbo.UFN_PROSPECTMANAGERHISTORY_VALIDENDDATE
(
@PROSPECTID uniqueidentifier,
@DATETO datetime
)
returns bit
with execute as caller
as begin
if exists (
select top 1
ID
from
dbo.PROSPECT
where
@PROSPECTID = ID and
(
(
(PROSPECTMANAGERSTARTDATE is not null) and
(PROSPECTMANAGERSTARTDATE < @DATETO)
) or
(
(PROSPECTMANAGERENDDATE is not null) and
(PROSPECTMANAGERENDDATE < @DATETO)
)
)
)
return 0;
return 1;
end