How to decrypt records from an SQL column - Query

Asked

Viewed 1,114 times

0

Good morning!

Guys, how to decrypt records from a column in an SQL query. The field I want to decrypt is the coluna MAX(A.Descricao) [Descrição da Última Providência].

SELECT CONVERT(DATE,T.TarData,103) [Data de Abertura],
    CONVERT(DATE,T.TarVencimento,103) [Data de Vencimento],
    U.UsuNome [Responsável],
    UC.UsuNome [Cliente - Nome Fantasia],
    UC.UsuRazaoSocial [Cliente - Razão Social],
    T.TarID [N° da Tarefa],
    E.EstagioDesc [Estágio],
    S.StatusDesc [Status],
    C.Descricao [Cliente - ABC],
    TI.TipDescricao [Caminho],
    UC.UsuCGC [Cliente - CNPJ],
    CONVERT(DATE,T.TarFechamento,103) [Data de Fechamento],
    UG.UsuNome [Gerador],
    M.DsModulo [Módulo],
    p.ProNome [Produto],
    T.TarTitulo [Título],
    T.TarNumAtiv [Número de Providências],
    MAX(CONVERT(DATE,a.AtivData,103)) [Data da Última Providência],
    MAX(A.Descricao) [Descrição da Última Providência]
FROM Tarefa t
LEFT JOIN Usuario U ON u.UsuID = t.UsuIDResponsavel
LEFT JOIN Usuario UC ON UC.UsuID = t.UsuIDCliente
LEFT JOIN Estagio E ON e.EstagioID = t.TarEstagioID
LEFT JOIN Status S ON s.CodStatus = t.TarStatus
LEFT JOIN CurvaABC C ON C.CurvaID = UC.CurvaID
LEFT JOIN Tipo TI ON ti.TipID = t.TarTipID
LEFT JOIN Usuario UG ON ug.UsuID = t.UsuIDInclusao
LEFT JOIN Modulo M ON m.ModID = t.ModID
LEFT JOIN Produto P ON p.ProID = t.ProID
LEFT JOIN Atividade A ON a.TarID= t.TarID
WHERE T.ProjID IS NOT NULL
GROUP BY T.TarID,T.TarTitulo, U.UsuNome, UC.UsuNome, UC.UsuRazaoSocial, UC.UsuCGC, 
    C.Descricao, E.EstagioDesc, S.StatusDesc, TI.TipDescricao, T.TarFechamento,
    UG.UsuNome, M.DsModulo, p.ProNome, t.TarNumAtiv, T.TarData, T.TarVencimento 
ORDER BY T.TarID
  • What would be "decryption"? Is the content of the Description column (Activity table) encoded? // Note that the junction of the Activity table is left Outer. You can come NULL.

  • If the intention is to decrypt, where is the encrypted data?

  • it is coming like this:0x456E766961646120656D3A2032372F30332F323031372031323A32343A33393C62723E4465.

  • 1

    This field is not the type VARBINARY? If yes just do SELECT CAST(Descricao AS VARCHAR(MAX)) as Descricao

  • 1

    that abfurlan, it worked. Thanks

  • Okay, I’ll post as an answer!

Show 1 more comment

1 answer

2

It’s not about cryptography, your field is apparently the type VARBINARY, if yes just make a CAST for VARCHAR, example:

SELECT CAST(Descricao AS VARCHAR(MAX)) as Descricao

Sqlfiddle

Browser other questions tagged

You are not signed in. Login or sign up in order to post.