INSERT INTO EST_TRIB_DARE_GERACAO
select
est_trib.CD_TRIB,
est_trib.CD_USU,
CONVERT(CHAR(10),GETDATE(),112)
from
est_trib left outer JOIN EST_TRIB_DARE_GERACAO ON
est_trib.CD_TRIB = EST_TRIB_DARE_GERACAO.CD_TRIB
where
est_trib.icms = 1
and EST_TRIB_DARE_GERACAO.CD_TRIB is null