DECLARE @KeyValue INT

SELECT @KeyValue = KeyValue FROM HotelSetup WHERE SearchKey = 'RatesPlanShowAvailability'

IF ISNULL(@KeyValue, -1) = -1
BEGIN
  SELECT @KeyValue = KeyValue FROM HotelSetup WHERE SearchKey = 'SwapRoomtypesAndRates'

  IF ISNULL(@KeyValue, -1) = -1
  BEGIN
    INSERT INTO HotelSetup (SearchKey, LabelName, KeyValue, TextValue)
      VALUES ('SwapRoomtypesAndRates', 'Swap Roomtypes and Rate Book buttons', 1, 'Yes')

    INSERT INTO HotelSetup (SearchKey, LabelName, KeyValue, TextValue)
      VALUES ('RatesPlanShowAvailability', 'Show availability', 3, 'Only roomtypes')
  END
  ELSE
    INSERT INTO HotelSetup (SearchKey, LabelName, KeyValue, TextValue)
      VALUES ('RatesPlanShowAvailability', 'Show availability', 1, 'Upsale mode')
END