---
title: "How to use Except in Sql server"  
description: "How to use Except in Sql server"  
author: "Anonymous User"  
published: 2016-03-08  
updated: 2016-03-08  
canonical: https://www.mindstick.com/forum/34041/how-to-use-except-in-sql-server  
category: "database"  
tags: ["sql server", "sql"]  
reading_time: 1 minute  

---

# How to use Except in Sql server

We want to use [Except](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) in [Sql server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server).how to use this please help me.

## Replies

### Reply by Anonymous User

**EXCEPT:** The EXCEPT operator returns all distinct the rows that are present in the result set of the first query, but not in the result set of the second query. It means it returns the difference between the two result sets.

```
CREATE TABLE ProductStock
(
ProductId INT PRIMARY KEY IDENTITY(1,1),
ProductName VARCHAR(100),
ManufacturedBy VARCHAR(100),
StockQty BIGINT,
LastUpdated date
)
Go
CREATE TABLE ProductOrder
(
OrderId INT PRIMARY KEY IDENTITY(1,1),
ProductId int,
ProductName VARCHAR(100),
ManufacturedBy VARCHAR(100),
OrderQty BIGINT,
OrderDate date
)
```

```
 ProductStock:  ProductOrder:  EXCEPT QUERY: SELECT ProductId,ProductName,ManufacturedBy FROM ProductStock
EXCEPT
SELECT ProductId,ProductName,ManufacturedBy FROM ProductOrder
```

```
Result :
```


---

Original Source: https://www.mindstick.com/forum/34041/how-to-use-except-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
