-- dbo.ET_TabVyroba_Objednavky_Pol_D
CREATE TRIGGER dbo.ET_TabVyroba_Objednavky_Pol_D ON dbo._TabVyroba_Objednavky_Pol
WITH EXECUTE AS CALLER
FOR DELETE
AS
BEGIN
 SET NOCOUNT ON

-- !! trigger neupravujte, bude stejne pregenerovan pri startu pluginu PluginHDCRTN !!

 DECLARE
  @id INT
  



-- cisteni 
 IF EXISTS(SELECT 1 FROM dbo._TabVyroba_Objednavky_Pol)
   BEGIN
    SELECT @id=MAX(ID) FROM dbo._TabVyroba_Objednavky_Pol
    DBCC CHECKIDENT(_TabVyroba_Objednavky_Pol, RESEED, @id)
   END
  ELSE
   TRUNCATE TABLE dbo._TabVyroba_Objednavky_Pol

END
