--begin tran
DECLARE @SearchKeyNew VARCHAR(20)
SET @SearchKeyNew = 'BonusIntfPaymentId'
IF (SELECT COUNT(*) FROM Hotelsetup (nolock) where Searchkey = @SearchKeyNew) = 0
BEGIN
  DECLARE @KeyValue INT, @SearchKeyOld VARCHAR(20)
  SET @SearchKeyOld = 'BonusSystemPaymentId'
  SELECT @KeyValue = KeyValue FROM Hotelsetup (nolock) where Searchkey = @SearchKeyOld
  SET @KeyValue = ISNULL(@KeyValue, 0)
  IF @KeyValue > 0
  BEGIN
    DECLARE @KeyValueNew VARCHAR(20)
    SET @KeyValueNew = '1, '+CONVERT(VARCHAR, @KeyValue)
    EXEC HotelSetupSettingUpdateValue @SearchKeyNew, @KeyValueNew 
  END
END
/*
PRINT @KeyValueNew
SELECT KeyValue FROM Hotelsetup (nolock) where Searchkey = @SearchKeyNew
SELECT dbo.GetHotelSetupKeyValue(@SearchKeyNew, 0)
rollback tran
*/
