Using Stored Procedure returned fields in another Stored Proc or Query
From: BGS (anonymous_at_discussions.microsoft.com)
Date: 06/18/04
- Next message: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Previous message: schmidtk: "using a variable for a @TO parameter in xp_stmp_sendmail"
- Next in thread: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Reply: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Jun 2004 19:21:19 -0700
Hi all,
I've got a Join All stored proc which returns about
120,000 records.
It simpley returns Account number field and Balance field
for each acustomer ccount for each table.
I want to use the returned data as if it were just
another table or view. As in:
Select * from spGetAllAccountBalances
or Retrieving the customers Credit Limit and linking to
the customers AccountBallance:
SELECT
spGetAllAccountBalances.Acct,
spGetAllAccountBalances.Bal,
Customer.CreditLimit,
FROM
dbo.Customer
INNER JOIN
spGetAllAccountBalances
ON
Customer.Acct = spGetAllAccountBalances.Acct
I just can't get at the stored proc data...
I don't mind doing this thru a stored procedure but would
prefer to use in a view...
Any help would be appreciated,
Thanks
BGS
-----------------
CREATE PROCEDURE spGetAllAccountBalances
@year as char(4),
@period as char(2)
AS
SELECT
A.ACCT, A.BAL
FROM
dbo.A
WHERE CAST(RTRIM(A.FISCYR) + RTRIM(A.FISCPER) AS INT)
<= CAST(@year + @period AS INT)
UNION ALL
SELECT
B.ACCT, B.BAL
FROM
dbo.B
WHERE CAST(RTRIM(B.FISCYR) + RTRIM(B.FISCPER) AS INT)
<= CAST(@year + @period AS INT)
UNION ALL
----- Table c,d,e, etc...
GO
- Next message: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Previous message: schmidtk: "using a variable for a @TO parameter in xp_stmp_sendmail"
- Next in thread: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Reply: Hari: "Re: Using Stored Procedure returned fields in another Stored Proc or Query"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|