Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BITSET() and BITTEST () with Varbinary(2)

Status
Not open for further replies.

stepen123

Technical User
Jan 20, 2011
9
Hello,
I have a field pos_bin, which is Varbinary(2).

The following command:

REPLACE pos_bin WITH BITSET(pos_bin,1)

produces 0200 in the field and

REPLACE pos_bin WITH BITSET(pos_bin,8)

gives 0201.

How can I revert the result, so that when I set bit #0 I get 0001 and when I set bit #8 I get 0100? Why is the least significant byte on the left?

Regards,
Stephen
 
See Varbinaries like a string displayed in hexeditor format, then it's clear why the first byte is left and not right. That's the way it is.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top