

declare @id_categoria as integer
set @id_categoria =(select id from rep_categoria where categoria='Traslado' and id_categoria=1)
declare @uid varchar(500)
select @uid=uid from seg_usuario where id=1

declare @id_reporte as integer
set @id_reporte =(select id from rep_reporte where reporte_codigo ='formatos/Traslado' )

if not exists (select * from rep_reporte_categoria where reporte_categoria ='TRS' and id_categoria=@id_categoria  and id_reporte=@id_reporte )
begin
insert into [rep_reporte_categoria] ([uid] ,[eid] ,[id_usuario_modifico] , [id_usuario_creo] ,[fechaModificacion] ,[fechaCreacion] ,[active] ,
reporte_categoria,[id_categoria] ,[id_reporte] )
values
(@uid,'01',1,1,GETDATE(),GETDATE(),1,'TRS',@id_categoria ,@id_reporte )
end



