ALTER PROCEDURE [dbo].[sp_SettingsUpdateInsert] @PropertyId nvarchar(255) ,@PropertyType int ,@PropertyValue nvarchar(255) ,@UserId nvarchar(255) = null ,@new_id int output ,@errorNumber int output ,@errorMessage nvarchar(250) output AS BEGIN set @errorNumber = 0 set @errorMessage = space(0) if(@UserId is null) begin RAISERROR(15600,-1,-1, '[sp_SettingsUpdateInsert]') /* Error 1560 - An invalid parameter or option was specified for procedure*/ end else begin if(exists(select * from [dbo].[Settings] where UserId = @UserId and PropertyId = @PropertyId)) begin set @new_id = 0 exec [dbo].[sp_SettingsUpdate] @PropertyId ,@PropertyValue ,@UserId ,@errorNumber output ,@errorMessage output end else begin exec [dbo].[sp_SettingsInsert] @PropertyId ,@PropertyType ,@PropertyValue ,@UserId ,@new_id output ,@errorNumber output ,@errorMessage output end --36831 The ImportCreateDynamicGroups setting has replaced the CSVImportCreateDynamicGroups setting, so --if a pre-Version 93 client sets the old setting, the new one should be set also, so that Version 93 --clients will have the value reflected in their "Use dynamic groups with CSV, EQX import" checkbox --(Version 93 clients will set both settings when the new one is set). --This ALTER script was added to the following migrations, since it wasn't added when the new setting first went in: --Versions 92, 93, 94, and 95. It also was not added to the starting database for 4.1, 4.2, and 4.3. if(@PropertyId = 'CSVImportCreateDynamicGroups') begin if(exists(select * from [dbo].[Settings] where UserId = @UserId and PropertyId = 'ImportCreateDynamicGroups')) begin exec [dbo].[sp_SettingsUpdate] 'ImportCreateDynamicGroups' ,@PropertyValue ,@UserId ,@errorNumber output ,@errorMessage output end else begin exec [dbo].[sp_SettingsInsert] 'ImportCreateDynamicGroups' ,@PropertyType ,@PropertyValue ,@UserId ,@new_id output ,@errorNumber output ,@errorMessage output end end end END