sql issue for ssrs
I am putting together a ssrs for finance and am trying to use the following select in the sql window of the ssrs. If you look this over you will see that there is a dbo. This is a sql scalar function that returns the approver name. The
parameter for it is the po number. The 45201 I hardcoded in to see if it does return a name. It does but it is the same name for all of the list. The return would be a list of the purchase orders with the 2 statuses. I tried using PO.PONumber
inplace of the number but did not work. What I am wondering is how can I place the ponumber in there? It can be done when the report runs if needed.
Thanks in advance for responding...John
SELECT
PO.PONumber
AS [PO Number],
PO.Date
AS [PO Date],
U.Fullname
AS Requester,
PO.Status,
Cast(Sum(POI.Cost)
AS
DECIMAL(12,2))
AS Subtotal,
(SELECT
Fullname FROM Employees
WHERE ID
= dbo.POGetPrimaryApproverID(45201))
AS Approver
FROM
PurchaseOrders PO JOIN PurchaseOrderItems POI
ON PO.PONumber
= POI.PONumber
JOIN POLimitGroupEmployees POLGE
ON PO.UsedByID
= POLGE.EmployeeID
JOIN Users U
ON POLGE.EmployeeID
= U.ID
WHERE
PO.Status
=
'Request Approval'
OR PO.Status
=
'Request Approval Sent'
GROUP
BY PO.PONumber,
PO.Date,
PO.Status,
U.Fullname
ORDER
BY PO.PONumber
November 30th, 2010 2:32pm