what will be output of this query?
declare @a int declare @b int set @a=5 set @b=11
select @a=@a^@b,@b=@b^@a,@a=@a^@b
print '@a='+convert(var char, @a)
declare @a int declare @b int set @a=5 set @b=11
select @a=@a^@b,@b=@b^@a,@a=@a^@b
print '@a='+convert(var char, @a)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Amitesh VermaRank #2,535 · 552 reputationPosted Jul 28, 2015, 11:49 PM EDT
4 XOr 2 = (0100) XOr (0010) = (0110) = 6 5 XOr 2 = (0101) XOr (0010) = (0111) = 7 6 XOr 2 = (0110) XOr (0010) = (0100) = 4Vignesh ManiRank #98 · 22.1K reputationPosted Jul 24, 2015, 10:29 AM EDT
select @a=@a^@b,@b=@b^@a,@a=@a^@b
print '@a='+convert(varchar, @a)
print '@b='+convert(varchar,@b)
@b=5
Ashutosh TripathiRank #2,423 · 582 reputationPosted Jul 24, 2015, 10:53 AM EDT
Ashutosh TripathiRank #2,423 · 582 reputationPosted Jul 29, 2015, 9:28 AM EDT