Answer: How do you create a byte with the value of 00000001 in SQL Server?

SQL Server 2005

My team mate Pi asked me today: how do you create a byte with the value 00000001 in SQL Server?

The answer is to create an integer representation of the byte's value, and cast it to binary.

SELECT CAST(CAST(1 AS TINYINT) AS BINARY(1))

The output in Management Studio is: 0x01 (Management Studio outputs binary fields in Hex format). Hex 0x01 = Bits 0000001.



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Answer: How do you create a byte with the value of 00000001 in SQL Server? | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.


Gold Coast Aquarium Maintenance | Gold Coast Marine Fish | Gold Coast Tropical Fish
Jewel Jones - Counselling Service - Penrith, Richmond
 
     
 Copyright © 2017 Julian Kuiters
 All trademarks and copyrights on this page are owned by their respective owners.