.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

what is the use of except keyword in sql server?

Posted By: Deco     Posted Date: September 20, 2010    Points:2   Category :Sql Server
Please give me the exact use of except key word in sql server
with an example

Author: Syed Shakeer Hussain          Accepted Answer   
Posted Date: September 20, 2010     Points: 10   

Except :-

To return all rows in table1 that do not match exactly the rows in table2, we can just use EXCEPT like this:

select * from table1 except select * from table2

Author: Suthish Nair             
Posted Date: September 20, 2010     Points: 5   

Microsoft introduced the EXCEPT operator in SQL Server 2005, which returns all of the distinct rows from the left side of the EXCEPT operator. It also removes all of the rows from the result set that match the rows that are on the right side of the EXCEPT operator.

refer example:


suthish nair
Author: Asha.MP          Accepted Answer   
Posted Date: September 21, 2010     Points: 10   


Except is like minus,

considar two tables
name id address
asha 1 Tumkur
usha 2 Tumkur
ashok 3 Bangalore

name id address
asha 1 Tumkur

select * from Table1
select * from Table2

this query result in two rows as

name id address
usha 2 Tumkur
ashok 3 Bangalore

Thanks and Regards,

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend