Link to home
Start Free TrialLog in
Avatar of franksale
franksale

asked on

Access (ADP) Report problem using a stored procedure

Hello everyone,

I've got a problem.  I am trying to run a report off of a Stored Procedure in SQL Server (using an ADP project database).  I bound the report to the Stored Procedure.  However, I get an error message when I run it.  I think it has something to do with my temporary table.  Do I need to issue an OUTPUT parameter?  Please help.  I have listed the code below.

---------------------------------------------------------------------------------------------------
CREATE PROCEDURE dbo.usp_Referrals_PotentialDuplicate1
AS

Create Table #TempTable (Account varchar(30), lastname varchar(30), dischargeDate DateTime, PTName varchar(30), RCVD smalldatetime, DIS smalldatetime, MGR char(10), Hospitalname Char(50), Hospitalcode Int)

Insert INTO #TempTable
Select referrals_dts.Account, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_DTS.hospital, hospitalcode
From Referrals_DTS INNER Join Patient_Table ON referrals_DTS.account = patient_table.account
where referrals_DTS.hospitalcode = Patient_Table.hospital

Insert INTO #temptable
Select type_indicator + referrals_dts.account as ptaccount, lastname, dischargeDate, patient_Table.[name], rcvd, dis, patient_table.mgr, referrals_dts.hospital, hospitalcode
from (referrals_DTS Inner Join Patient_Table ON referrals_DTS.account = patient_table.account) Left Join Patient_type ON referrals_dts.patienttype = patient_type.patient_type
Where type_indicator + referrals_dts.account = patient_table.account and referrals_DTS.hospitalcode = Patient_Table.hospital

Select * from #temptable

GO
----------------------------------------------------------------------
I get the error message: "Provider Command for Child Rowset Does not Produre a Rowset".

Please help.
Frank
ASKER CERTIFIED SOLUTION
Avatar of ragoran
ragoran
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of franksale
franksale

ASKER

Humm... That's is a good idea.  It looks like it will work.  Thanks for your help.  

I would still like to know how to send the information out of a stored procedure though.  It seems to work in Query Analyzer.  Other procedures seem to work when I am not using temporary tables.  Any ideas how to get it to work?

Frank
My guess is...

Temporary tables exist only dring the scope (e.g. execution time) of the store procedure.  so when the store procedure ends, its temporary object are destroyed (there are temporary after all)...