Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Location
    Argentina
    Posts
    26

    Unanswered: Hexadecimal String

    Hi,

    I want to convert a UNIQUEIDENTIFIER to a VARCHAR, but I don't want to convert it to a varchar with this format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx; I want to convert it to a varchar representing my uniqueindentifier with a hexadecimal number 0xnnnnnnn...
    Anybody knows if this is possible, or will I have to do it manipulating each character in the varchar

    Thanks,

    Federico

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Depending on exactly what you want, there are two ways to get there... THe simple answer is to use:
    Code:
    SELECT Cast(myGUID AS VARBINARY(20))  -- 20 is overkill, better safe than sorry
    If that isn't sufficient for your needs, then a small UDF will allow you as much flexibility as you know how to code!

    -PatP

Posting Permissions

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