Calling a stored procedure within a stored procedure. 
Author Message
 Calling a stored procedure within a stored procedure.

I am working on a stored that calls a stored procedure within itself.
For some reason or another I can't get the thing to work correctly.  Am
I correct in believing that you simply issue the EXEC command to call
another stored procedure??  So far this is what I've got..

CREATE PROCEDURE sp_Pro_Sup_Delete

AS DELETE


FROM tblProducts
        FROM tblProducts p, tblSuppliers s
WHERE p.Table_Suppliers_Counter = s.Table_Suppliers_Counter

To further explain my maddness, I'm trying to perform a cascading delete
on a series of related tables.  In doing this, I have to delete the
foreign keys first before I can delete the primary key.  The procedure
calls another procedure to delete the foreign keys and then deletes the
primary keys.  If you can tell me what I'm not doing correctly I'd
really apreciate it.

BTW, the error I recieve is 156, incorrect syntax near the keyword
'EXEC'.

Thanks in advance..

Brad Tanner



Sun, 14 Mar 1999 03:00:00 GMT
 Calling a stored procedure within a stored procedure.

You can't embed an "exec" call in the middle of your delete statement.  You
should start your procs out with an "as begin" right after the parameters
and an "end" at the very end to keep it clear, too!  

Quote:
> I am working on a stored that calls a stored procedure within itself.
> For some reason or another I can't get the thing to work correctly.  Am
> I correct in believing that you simply issue the EXEC command to call
> another stored procedure??  So far this is what I've got..
> CREATE PROCEDURE sp_Pro_Sup_Delete

> AS DELETE


> FROM tblProducts
>    FROM tblProducts p, tblSuppliers s
> WHERE p.Table_Suppliers_Counter = s.Table_Suppliers_Counter




Mon, 15 Mar 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Calling a Stored Procedure from within a Stored Procedure

2. Calling a Stored Procedure from within a Stored Procedure

3. Calling a stored procedure from within a stored procedure

4. Retrieving result from a stored procedure called within another stored procedure

5. Calling Oracle Stored Procedure from within SQL Server Stored Procedure

6. Calling a stored procedure on another server from within a stored procedure

7. Calling Stored Procedure that calls Stored Procedure in ASP

8. Calling a Java Stored Procedure from another Java Stored Stored Procedure

9. Calling a Stored Procedure within a Procedure

10. executing system stored procedures within a stored procedure

11. stored procedure within a stored procedure

12. Useing a stored procedure within a stored procedure.


 
Powered by phpBB® Forum Software