Results 1 to 4 of 4

Thread: Hex

  1. #1
    Join Date
    Sep 2003
    Location
    Dallas, Texas
    Posts
    311

    Unanswered: Hex

    Is there not a function in MS/SQL to return the hex representation of a character?

    HEX("A") = 41 for example.

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    [un-sniped]
    SELECT ASCII('A')
    SELECT CHAR(65)
    [/un-sniped]

    I swear your post beat me in, now it's the other way around...

    ORDER BY PostDate
    Last edited by Brett Kaiser; 12-16-03 at 11:58.
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    select cast(ascii('A') as varbinary)

    To flip to integer:

    select cast(0x0000002C as int)

    To convert back to character:

    select char(cast(ascii('A') as varbinary))

  4. #4
    Join Date
    Sep 2003
    Location
    Dallas, Texas
    Posts
    311
    Thanks so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •