UFN_RESERVATIONRATESCALE_ISPROGRAMINCLUDED
Indicates whether or not a program is included in the rate scale on a reservation.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | |
@PROGRAMID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_RESERVATIONRATESCALE_ISPROGRAMINCLUDED
(
@ID uniqueidentifier,
@PROGRAMID uniqueidentifier = null
)
returns bit
with execute as caller
as
begin
if @PROGRAMID is null
return 0;
if exists
(
select top 1 1 from dbo.RESERVATIONRATESCALE
left join dbo.RESERVATIONRATESCALEPROGRAM on
RESERVATIONRATESCALE.ID = RESERVATIONRATESCALEPROGRAM.RESERVATIONRATESCALEID
where
RESERVATIONRATESCALE.ID = @ID and
(
(
RESERVATIONRATESCALEPROGRAM.PROGRAMID is not null and
RESERVATIONRATESCALEPROGRAM.PROGRAMID = @PROGRAMID
)
or
INCLUDEALLPROGRAMS = 1
)
)
begin
return 1;
end
return 0;
end