Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 197861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:53:21+00:00 2026-05-11T16:53:21+00:00

So I have this query working (where signal_data is a column) in Sybase but

  • 0

So I have this query working (where signal_data is a column) in Sybase but it doesn’t work in Microsoft SQL Server:

HEXTOINT(SUBSTRING((INTTOHEX(signal_data)),5,2)) as Signal

I also have it in Excel (where A1 contains the value):

=HEX2DEC(LEFT(DEC2HEX(A1),LEN(DEC2HEX(A1))-2))

Does anyone know how I would do this in SQL Server?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T16:53:21+00:00Added an answer on May 11, 2026 at 4:53 pm

    Convert INT to hex:

    SELECT CONVERT(VARBINARY(8), 16777215)
    

    Convert hex to INT:

    SELECT CONVERT(INT, 0xFFFFFF)
    

    Update 2015-03-16

    The above example has the limitation that it only works when the HEX value is given as an integer literal. For completeness, if the value to convert is a hexadecimal string (such as found in a varchar column) use:

    -- If the '0x' marker is present:
    SELECT CONVERT(INT, CONVERT(VARBINARY, '0x1FFFFF', 1))
    
    -- If the '0x' marker is NOT present:
    SELECT CONVERT(INT, CONVERT(VARBINARY, '1FFFFF', 2))
    

    Note: The string must contain an even number of hex digits. An odd number of digits will yield an error.

    More details can be found in the “Binary Styles” section of CAST and CONVERT (Transact-SQL). I believe SQL Server 2008 or later is required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query working but it is not returning back exactly what I
I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I have this query that joins 3 table. It appears to be working but
I have this strange error in SQL Server 2005 where I take a working
INFO: I am working with Microsoft SQL. Ok the title is confusing but here
This query was working for me until recently. I now have 135 InstallationSummary documents
I have this query that I am working on for a one time report.
So I have managed to get this query working List<string> listStatus = new List<string>()
I have this query in which one of the column is a calculated one.
I have this query which is not returning any rows. But there are records

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.