Azure SQL basic bit manipulation?

Gary K 1 Reputation point
2022-11-09T05:36:11.377+00:00

I would like to create a function in a dedicated Azure Synapse SQL pool that will need to shift bits right >>.
What functions/operators are available to do this?
RIGHT_SHIFT and >> don't work for me, and I can't find anything about any bit manipulation in Azure, only for SQL Server 2022 ...

edit: I realize now that I tagged the question wrong.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2022-11-09T09:38:55.747+00:00

    Hi @Gary K ,

    Welcome to Microsoft Q&A platform and thanks for using Azure services.

    As I understand your question, you want to understand RIGHT_SHIFT in Azure SQL database.

    Please refer below where RIGHT_SHIFT example is shown:

    258721-image.png

    SELECT RIGHT_SHIFT(12345, 5);  
    

    The result is 385. If you convert 12345 to binary, you have 0011 0000 0011 1001. Shifting this to the right by 5 becomes 0001 1000 0001, which is 385 in decimal.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.