Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
this was one of interview question


SQL
select 1000&555

its giving 

552 as output 


select 1000|555

its giving 

1003 as output 


my question is how come 552 and 1003
Posted

What to explain? Please read the documentation: Bitwise Operators (Transact-SQL)[^]
A secret is in binary representation of numbers...
 
Share this answer
 
http://www.blackwasp.co.uk/SQLBitwiseOperators.aspx

convert number in binary then perform logical AND or OR operator
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900