create procedure rrhh.sp_limpiarAdjuntosEmpleado
@txtCodempleado varchar(15),
@txtIdsValidos varchar(6000)
as
begin
	set nocount on;
	declare @dbSql varchar(8000);

	set @dbSql = 'UPDATE rrhh.det_adjuntosEmpleado set estado = 0 where codempleado = '''+cast(@txtCodempleado as varchar)+ ''' and estado = 1 and id not in('+@txtIdsValidos+')';

	exec(@dbSql);
end