UFN_EVENTLODGINGLOCATIONROOM_ISUNIQUE

Verifies only one room type per event lodging location.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@EVENTLODGINGID uniqueidentifier IN
@ROOMTYPECODEID uniqueidentifier IN

Definition

Copy


      create function dbo.UFN_EVENTLODGINGLOCATIONROOM_ISUNIQUE(
        @EVENTLODGINGID uniqueidentifier,
        @ROOMTYPECODEID uniqueidentifier
        )

        returns bit
        with execute as caller
        as begin
          declare @DUPLICATECOUNT int;

          select
            @DUPLICATECOUNT = count(ID)
          from
            dbo.EVENTLODGINGROOM
          where
            ROOMTYPECODEID = @ROOMTYPECODEID and
            EVENTLODGINGID = @EVENTLODGINGID

          if @DUPLICATECOUNT < = 1
            return 1;

          return 0;
        end