Using a Stored Procedure in a Pass-Through

AdamFeerst

Registered User.
Local time
Today, 08:22
Joined
Sep 21, 2015
Messages
63
Why isn't this working?
SELECT usp_BillerStatus.* FROM usp_BillerStatus

Error message:
ODBC--call failed
Invalid object name 'usp_BillerStatus'. #208.

However, Execute usp_BillerStatus does work.

These are pass-through queries from Access2013 running on a SQL server 2005
 
I don't think you can call a stored procedure with a SELECT. I use them in pass through queries like:

EXEC ProcName
 
The bigger/real issue is that I want to refer to the stored procedure in another pass-through.

WITH BillerIDProd as (SELECT tblBillerList.*, tblBillerIDProd.PROD, tblBillerIDProd.Status AS 'PRDSTS' FROM tblBillerList INNER JOIN tblBillerIDProd ON tblBillerList.ClientID = tblBillerIDProd.ClientID) SELECT BillerIDProd.*, usp_BillerStatus.Status as 'UStatus' FROM BillerIDProd LEFT JOIN usp_BillerStatus ON BillerIDProd.ClientID = usp_BillerStatus.AcctID
 
A stored procedure cannot be used in a Select. They can only be executed.

One way use a stored procedure in a Select is to wrap it in a table valued function. The function can be used as a table in a Select query.
 
Thanks. We're either going to use Table Valued Functions or,
Build them entirely as stored procedures, create Execute pass-throughs, then use those as record sources for the forms and reports.

I'm writing all the SQL code in Access for now. Then the SQL dba (not me) will be able to modify them to work as TVFs or SPs. I have more band width than he does.
 

Users who are viewing this thread

Back
Top Bottom