Código:
porfis ayuyaaaaa case descrip_form.tipo when 't' then convert(nvarchar(4000),isnull(valor_hist.v_t,'--')) when 's' then convert(nvarchar(800),isnull(valor_hist.v_t,'--')) when 'c' then if exists(select cod_ubic from valor_hist where cod_ubic = @cod_ubic and cod_campo = '4263') begin set @var='s' select @var as mercado end else begin set @var='n' select @var as mercado end when 'm' then convert(nvarchar(4000),isnull(valor_hist.v_m,'--')) when 'n' then convert(nvarchar(200),convert(int,isnull(valor_hist.v_n,'0'))) when 'f' then convert(nvarchar(10),isnull(valor_hist.v_f,null) ,103) when 'e' then 'Titulo' else '--' end as valor