Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin
- declare @newFormId uniqueidentifier = '07266ABF-BBE8-49CC-8631-003C77979C68'
- declare @oldFormId uniqueidentifier = '42663521-a111-4202-9cb6-46b18734caf2'
- declare @billId uniqueidentifier = 'd1a04022-dff1-481e-aebd-4ac5dd144f72'
- update Billy..TariffPositions
- set ShippingStrategy = case (select count(*) from Billy..Shipments where BillId = @billId) when 0 then 1 when 1 then 0 end
- from Billy..TariffPositions tp join Billy.dbo.BillSpecifications bs on bs.Id = tp.BillSpecificationId
- where bs.BillId = @billId
- insert into Billy..CertificateApplications(Id, BillId, PartnerId, ActsOnTheBasis, Appointment, Fio, PreambleAppointment,
- PreambleFio, AddressLegal, [State], [Type], RecipientId, CreatedDate, ProductId,
- [Timestamp], Reason, Duration, OldThumbprint, HasLicense, ExtendedReason, Purposes)
- select @newFormId, BillId, PartnerId, ActsOnTheBasis, Appointment, Fio, PreambleAppointment,
- PreambleFio, AddressLegal, 0, [Type], RecipientId, CreatedDate, ProductId,
- Billy.dbo.DateTimeToTicks(GETDATE()), Reason, Duration, OldThumbprint, HasLicense, ExtendedReason, Purposes
- from Billy..CertificateApplications
- where Id = @oldFormId
- select from BillyPartners..CertificateInfos
- where Id = '07266ABF-BBE8-49CC-8631-003C77979C68
- insert into BillyPartners..CertificateInfos (Id, BillId, PartnerId, State, Type, TimeStamp, OldThumbprint, Reason, ExtendedReason)
- select Id, BillId, PartnerId, State, [Type], TimeStamp, OldThumbprint, Reason, ExtendedReason
- from Billy..CertificateApplications ca
- where ca.Id = '07266ABF-BBE8-49CC-8631-003C77979C68'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement