Properties

Owner: dbo 
Encrypted:  
Creation Date: 08/06/2000 
Description:  

Creation options

QUOTED_IDENTIFIER:  
ANSI_NULLS:  

Parameters

Name Direction DataType Length
  @OrderID  INPUT  int 
Total: 1 parameter(s)

Objects that [dbo].[CustOrdersDetail] depends on

Object Name Owner Object Type Dep Level
  Categories  dbo  Table 
  Customers  dbo  Table 
  Employees  dbo  Table 
  Shippers  dbo  Table 
  Suppliers  dbo  Table 
  Orders  dbo  Table 
  Products  dbo  Table 
  Order Details  dbo  Table 
Total: 8 object(s)

Permissions

User/Role Select Insert Delete Update Execute DRI
  public          GRANT   
Total: 1 permission(s)

SQL

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE CustOrdersDetail @OrderID int
AS
SELECT ProductName,
    UnitPrice=ROUND(Od.UnitPrice, 2),
    Quantity,
    Discount=CONVERT(int, Discount * 100),
    ExtendedPrice=ROUND(CONVERT(money, Quantity * (1 - Discount) * Od.UnitPrice), 2)
FROM Products P, [Order Details] Od
WHERE Od.ProductID = P.ProductID and Od.OrderID = @OrderID

GO
SET QUOTED_IDENTIFIER OFF
GO

GO
SET ANSI_NULLS OFF
GO

See Also

List of stored procedures