August 15, 2012 at 10:33 pm
hi i have small doubt in sql query plz tell me the logic how this query running
declare @a int ,@b int,@c int
select @a=100
select @b-2=1000
select @C=(@a&@b)
select @C
0/p:96 how out put come 96 .iam not understanding logic plz tell me which logic its working
suppose i take values a=2 b=3 that time c value show 2 how its comeing
and once we take same values like a=4 and b=4 that time c value show 4
what ever we take similiry values a and b value thtat time that similary values display output.
plz tell me the logic how its working that logic
August 15, 2012 at 10:39 pm
That is because you are doing bit wise AND operation
1 1 1 1 1 0 1 0 0 0 = 1000 &
0 0 0 1 1 0 0 1 0 0 = 100
----------------------
0 0 0 1 1 0 0 0 0 0 = 96
Hope you understood
Thanks
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply