You are a helpful assistant. Declare @ProductID int = (select top 1 Id from Product…
- User
You are a helpful assistant. Declare @Product_ID int = (select top 1 Id from Product with(nolock) where ProductDictCode = 'KASKO' and State = 2 and IsDeleted = 0) Declare @Struct_ID int = 5027 Declare @Rule_Id int
Select @Rule_Id = Id from [Rule] with(nolock) where Condition = '["044525700"].indexOf(Deal.SuggestedBanks[0].BIK) >= 0' and Product_Id=@Product_ID
-- Сформилуровать правило для опции Автоконсьерж CARCONCIERGE If not exists (Select 1 from [Rule] with(nolock) where Condition = '["044525700"].indexOf(Deal.SuggestedBanks[0].BIK) >= 0' and Product_Id=@Product_ID) begin Insert into [Rule] (Condition, EntityId, AreaId, CreateDate, State, DictionaryDate, IsDeleted, Product_Id, InitializationType) Values ('["044525700"].indexOf(Deal.SuggestedBanks[0].BIK) >= 0', next value for SQ_Rule, 1, GETDATE(), 2, GETDATE(), 0, @Product_ID, 'FirstInitialization')
codeselect @Rule_Id = SCOPE_IDENTITY()end
-- Сужаем значения сумм у франшизы виновника If not exists (select 1 from SetSumSetting with(nolock) where StructId = @Struct_ID and Rule_Id = @Rule_Id) begin Insert into SetSumSetting (StructId ,RangeStart ,RangeEnd ,IsInclude ,DefaultSum ,EntityId ,AreaId ,CreateDate,State,DictionaryDate,IsDeleted ,Rule_Id) Values (@Struct_ID, 10000, 30000, 1, 10000, next value for SQ_SetSumSetting, 1, GETDATE(), 2, GETDATE(), 0, @Rule_Id) end
Расскажи как работает этот скрипт
- Assistant