CREATE FUNCTION dbo.ValidateRoomOwner(@Room INT)
RETURNS INT

-- KJ 20060323: RomOwner now stored in Rooms table and not Customer

AS
BEGIN
/*
  DECLARE @ROOMOWNER INT
  SELECT @ROOMOWNER = CUSTOMERNUMBER FROM Customer (NOLOCK) WHERE rowner = (select roomnumber from rooms (nolock) where number = @room)
  RETURN isNull(@ROOMOWNER, 0)
*/
  DECLARE @RoomOwner INT
  SELECT @RoomOwner = CustomerNumber FROM Rooms WITH (NOLOCK) WHERE Number = @Room
  RETURN ISNULL(@RoomOwner, 0)
END

