IF NOT EXISTS (select * from sys.objects where type = 'TR' and name = 'UPDATE_FUEL')
EXEC dbo.sp_executesql @statement = N'
CREATE TRIGGER [dbo].[UPDATE_FUEL] ON dbo.[MIETVERTRAEGE] FOR INSERT,UPDATE
as
SET NOCOUNT on
BEGIN
update Autos set FUEL_LEVEL = dbo.AUTOS_GET_TANKSTAND(MVANUMMER)
WHERE MVANUMMER IN (Select mvanummer from INSERTED) OR  MVANUMMER IN (Select mvanummer from DELETED)
end'

alter table MIETVERTRAEGE enable trigger [UPDATE_FUEL]