GOOD....

I'M NEW IN SQL...

I HAVE THIS TRIGGER ....



set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[trigsl]
on [dbo].[sl]
AFTER INSERT, UPDATE
AS

declare @ref varchar(18)
declare @lote varchar(15)
declare @sestamp varchar(30)
declare @design varchar(60)
declare @epcult numeric(19,6)
declare @CM NUMERIC(6)


declare @ref_ varchar(18)
declare @lote_ varchar(15)
declare @SEStam varchar(30)
declare @DOCNUM NUMERIC
declare @DOCN NUMERIC



SELECT @CM = sl.cm, @ref = sl.ref, @lote = sl.lote, @design = sl.design , @sestamp = sl.slstamp from inserted sl

IF @CM = 7 OR @CM = 54
BEGIN
select @SEStam = se.sestamp from se where se.sestamp = @sestamp
IF @SEStam IS NOT NULL
BEGIN
UPDATE se
SET se.ref = @ref,
se.lote = @lote,
se.design = @design
WHERE se.sestamp = @SEStam
END
ELSE
BEGIN
insert into se (ref,lote,design,sestamp)
values ( @ref,@lote,@design,@sestamp)
END
END





I HAVE THIS TRIGGER AND I WAN'T TO LIMIT WITH....

COMMAND IF NOT EXISTS, I THINK...

I WAN'T LIMIT WITH IF SE.LOTE EXISTS...DON'T INSERT....HOW I DO THIS WITH THIS TRIGGER?

THANKS