Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. begin
  2. declare @newFormId uniqueidentifier = '07266ABF-BBE8-49CC-8631-003C77979C68'
  3. declare @oldFormId uniqueidentifier = '42663521-a111-4202-9cb6-46b18734caf2'
  4. declare @billId uniqueidentifier = 'd1a04022-dff1-481e-aebd-4ac5dd144f72'
  5.  
  6. update Billy..TariffPositions
  7. set ShippingStrategy = case (select count(*) from Billy..Shipments where BillId = @billId) when 0 then 1 when 1 then 0 end
  8. from Billy..TariffPositions tp join Billy.dbo.BillSpecifications bs on bs.Id = tp.BillSpecificationId
  9. where bs.BillId = @billId
  10.  
  11. insert into Billy..CertificateApplications(Id, BillId, PartnerId, ActsOnTheBasis, Appointment, Fio, PreambleAppointment,
  12. PreambleFio, AddressLegal, [State], [Type], RecipientId, CreatedDate, ProductId,
  13. [Timestamp], Reason, Duration, OldThumbprint, HasLicense, ExtendedReason, Purposes)
  14. select @newFormId, BillId, PartnerId, ActsOnTheBasis, Appointment, Fio, PreambleAppointment,
  15. PreambleFio, AddressLegal, 0, [Type], RecipientId, CreatedDate, ProductId,
  16. Billy.dbo.DateTimeToTicks(GETDATE()), Reason, Duration, OldThumbprint, HasLicense, ExtendedReason, Purposes
  17. from Billy..CertificateApplications
  18. where Id = @oldFormId
  19.  
  20. select from BillyPartners..CertificateInfos
  21. where Id = '07266ABF-BBE8-49CC-8631-003C77979C68
  22.  
  23.  
  24. insert into BillyPartners..CertificateInfos (Id, BillId, PartnerId, State, Type, TimeStamp, OldThumbprint, Reason, ExtendedReason)
  25. select Id, BillId, PartnerId, State, [Type], TimeStamp, OldThumbprint, Reason, ExtendedReason
  26. from Billy..CertificateApplications ca
  27. where ca.Id = '07266ABF-BBE8-49CC-8631-003C77979C68'
  28.  
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement