Convert Binary or Hex field to show text information

  • Hi all,

    I have an SQL database table with events, and within it a field of binary (32) datatype.

    I want to convert the info in binary field and show me the information that refers to the event.

    The info is of this type: 0x0000000000000000000000000000000000000000000000000000000000002000.

    Can someone help?

    Thanks!!

     

  • You could try convert(binary(32),'text',1)

    DECLARE @Myvalue5 binary(32)=convert(binary(32),'0x0000000000000000000000000000000000000000000000000000000000002000',1)
    SELECT @Myvalue5

    CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn

  • Any data type can be converted to binary, and it's impossible to tell from what you have given us what data type to convert back to.  I tried VARCHAR, NVARCHAR, INT, and DATETIME successfully with different results.  I don't know which of those results makes sense, though.  DATE failed to convert, but that could just be a result of bad sample data.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • I need to know the action behind the binary string, and not just to convert the info in binary field to text.

    Any ideas?

  • Kakavotas7, consult the people who created the database if you want the meaning. Could be a hardcoded value or a reference to another field / parameter table

  • kakovatos7 wrote:

    I need to know the action behind the binary string, and not just to convert the info in binary field to text.

    Any ideas?

    I'm guessing you have a table with a list of events, and an "action" column that is stored as binary???

    It appears that the developers did this to purposely obfuscate the action associated with an event.  If that's the case, you may not be able to determine what the action may be.  When an event is raised, the action is queries from this table, and that binary value is what is us3d to trigger the action.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply