Estimado
Utilize el siguiente codigo
if @transaction_type = ('A') and @object_type = 59 begin declare @Refe as Nvarchar(50) set @Refe = (select U_NumPorcipos from OIGN where DocEntry = @list_of_cols_val_tab_del) if exists (select count(A.U_NumPorcipos) from OIGN A INNER JOIN IGN1 B on A.DocEntry=B.DocEntry where A.U_NumPorcipos = @Refe AND B.WhsCode IN (select distinct C.WhsCode from IGN1 C where C.DocEntry=@list_of_cols_val_tab_del) having count(A.U_NumPorcipos) > 1) begin set @error =-5000 set @error_message ='SP:Existe Número de Referencia duplicado' end end
Saludos cordiales
Felipe Loyola