Owner: | dbo |
Encrypted: | |
Creation Date: | 08/06/2000 |
Description: |
QUOTED_IDENTIFIER: | |
ANSI_NULLS: |
Name | Direction | DataType | Length | |
|
@CustomerID | INPUT | nchar | 10 |
Objects that [dbo].[CustOrderHist] depends on
Object Name | Owner | Object Type | Dep Level | |
|
Categories | dbo | Table | 1 |
|
Customers | dbo | Table | 1 |
|
Employees | dbo | Table | 1 |
|
Shippers | dbo | Table | 1 |
|
Suppliers | dbo | Table | 1 |
|
Orders | dbo | Table | 2 |
|
Products | dbo | Table | 2 |
|
Order Details | dbo | Table | 3 |
User/Role | Select | Insert | Delete | Update | Execute | DRI | |
|
public | GRANT |
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE CustOrderHist @CustomerID nchar(5)
AS
SELECT ProductName, Total=SUM(Quantity)
FROM Products P, [Order Details] OD, Orders O, Customers C
WHERE C.CustomerID = @CustomerID
AND C.CustomerID = O.CustomerID AND O.OrderID = OD.OrderID AND OD.ProductID = P.ProductID
GROUP BY ProductName
GO
SET QUOTED_IDENTIFIER OFF
GO
GO
SET ANSI_NULLS OFF
GO
See Also
List of stored procedures