Professional Web Applications Themes

Hexadecimal to Decimal conversion - Microsoft SQL / MS SQL Server

Hi You may want to check out the information from this thread in the archives [url]http://tinyurl.com/geyf[/url] John "news" <vitaliedonicompudava.com> wrote in message news:uj$L2hfRDHA.3236TK2MSFTNGP10.phx.gbl... > Hi ! > There is any function in T_SQL to convert values in Hexadecimal to Decimal / > Thx > >...

  1. #1

    Default Re: Hexadecimal to Decimal conversion

    Hi

    You may want to check out the information from this thread in the archives

    [url]http://tinyurl.com/geyf[/url]

    John


    "news" <vitaliedonicompudava.com> wrote in message
    news:uj$L2hfRDHA.3236TK2MSFTNGP10.phx.gbl...
    > Hi !
    > There is any function in T_SQL to convert values in Hexadecimal to Decimal
    /
    > Thx
    >
    >

    John Bell Guest

  2. #2

    Default Re: Hexadecimal to Decimal conversion

    Strange, I kept getting an error when trying to convert to decimal(10,0) but
    it worked with int... Then you can convert to decimal if you wish

    declare a varbinary(5)
    select a = 0xff5f
    select a
    select convert (int, a)



    "news" <vitaliedonicompudava.com> wrote in message
    news:uj$L2hfRDHA.3236TK2MSFTNGP10.phx.gbl...
    > Hi !
    > There is any function in T_SQL to convert values in Hexadecimal to Decimal
    /
    > Thx
    >
    >

    Wayne Snyder Guest

  3. #3

    Default Re: Hexadecimal to Decimal conversion

    DECLARE hexstr VARCHAR(10), exec AS NVARCHAR(50), result INTEGER

    SET hexstr = '0xFFFF'

    SET exec = 'SET result = CAST(' + hexstr + ' AS INTEGER)'
    EXEC sp_executesql exec, N' result INTEGER OUTPUT', result OUTPUT

    SELECT result


    Alternatively, here's a UDF:

    [url]http://groups.google.com/groups?&selm=3cf29f57.0304020720.3272c899%40postin g[/url]
    ..google.com

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --

    "news" <vitaliedonicompudava.com> wrote in message
    news:uj$L2hfRDHA.3236TK2MSFTNGP10.phx.gbl...
    > Hi !
    > There is any function in T_SQL to convert values in Hexadecimal to Decimal
    /
    > Thx
    >
    >

    David Portas Guest

  4. #4

    Default Hexadecimal to Decimal conversion

    Hi !
    There is any function in T_SQL to convert values in Hexadecimal to Decimal /
    Thx


    news Guest

  5. #5

    Default Help Needed with Stored Procedures

    Hi all!
    I am in need of writing a few stored procedures for a class project.

    The first one is to create a stored procedure to recover a database from
    backup and the second one is to create a stored procedure to execute a
    transaction log backup (even though I know this can be done through a
    maintainence plan). Any help would be greatly appreciated.
    Thanks in advance!

    Maria Guest

Similar Threads

  1. how to convert decimal to hexadecimal in perl
    By indie in forum Perl / CGI
    Replies: 2
    Last Post: July 12th, 11:47 AM
  2. Replies: 0
    Last Post: July 21st, 08:44 AM
  3. Replies: 0
    Last Post: July 10th, 04:26 PM
  4. Replies: 0
    Last Post: July 10th, 03:58 PM
  5. Decimal to Hexadecimal Conversion
    By Wayne Snyder in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 9th, 09:19 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139