BEGIN TRANSACTION

--DELETE
--FROM tbOrderDeliverySchedule
--WHERE VendorId = 10

INSERT INTO tbOrderDeliverySchedule (
	EntityId
	,VendorId
	,OrderDay
	,DeliveryDue
	,CoverUntil
	)
SELECT entityid
	,10
	,1
	,'2019-12-31 03:00:00.000'
	,'2020-01-01 03:00:00.000'
FROM tbEntity
--WHERE EntityID = 3932
--WHERE EntityTypeID = 4 AND STATUS = 'open'
WHERE EntityTypeID = 4 and Entity like 'inform%' and STATUS = 'open'
ORDER BY EntityID


INSERT INTO tbOrderDeliverySchedule (
	EntityId
	,VendorId
	,OrderDay
	,DeliveryDue
	,CoverUntil
	)
SELECT entityid
	,10
	,2
	,'2020-01-01 03:00:00.000'
	,'2020-01-03 03:00:00.000'
FROM tbEntity
--WHERE EntityID = 3932
--WHERE EntityTypeID = 4 AND STATUS = 'open'
WHERE EntityTypeID = 4 and Entity like 'inform%' and STATUS = 'open'
ORDER BY EntityID

--SELECT *
--FROM tbOrderDeliverySchedule

--ROLLBACK
--COMMIT



--Select * FROM tbOrderDeliverySchedule with (nolock) WHERE VendorId = 10


--SELECT *
--FROM tbEntity
--WHERE EntityTypeID = 4 and Entity like 'inform%' and STATUS = 'open'