Consider a table with 8 rows 4 rows contains value 0 and 4
rows contains value 1.Now write a single update query to make
all 0's as 1 and all 1's as 0

Answer Posted / krishna reddy l

update example set column1 = case when column1=0 then 1
when column1=1 then 0 end

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to delete duplicate rows?

544


What is triggers in ms sql server?

635


How to deploy the Report?

93


What is a synonym for manipulation?

538


What is federation member?

91






What is the fastest way to permanently delete a 1 million row table named customers?

592


What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration

599


Show Practically Sql Server Views are updatable?

584


Why do we use functions?

504


What is the use of =,==,=== operators?

567


How can you stop stored procedures from recompiling?

483


Can I run multiple instances of sql server 2000 at the same time on one computer?

588


What does set rowcount do?

506


What are the new features are introduced in sql server 2012 reporting services?

105


How to stop a loop early with break statements in ms sql server?

558