Called and Calling store procedure problem !! 
Author Message
 Called and Calling store procedure problem !!

Dear all,
i have two store procedure sp_a and sp_b in MSSQL2000.
Which sp_a will call sp_b and both of them have create a temp table with
same name "#tmp_1" but different structure !
when sp_a execute, error occurse :
Server: Msg 213, Level 16, State 4, Procedure tmp_sp_1, Line 7
[Microsoft][ODBC SQL Server Driver][SQL Server]Insert Error: Column name or
number of supplied values does not match table definition.

In MSSQL6.5 , this error do not occurs !!!
Can any tell me why and how can i solve this error !(don't to modify any
store proc)

THS

Andrew



Sat, 03 Jul 2004 14:25:30 GMT
 Called and Calling store procedure problem !!

Well, Nested stored procedures can also create temporary tables with the
same name as a temporary table created by the stored procedure that called
it. All references to the table name in the nested stored procedure are
resolved to the table created in the nested procedure.
The following example worked for me (both SPs have create a temp table with
same name "#t" but different structure):
-------------------
Create PROCEDURE Test2
AS
CREATE TABLE #t(x varchar(2) PRIMARY KEY )
INSERT INTO #t VALUES ('2' )
SELECT Test2Col = x FROM #t
GO
Create PROCEDURE Test1
AS
CREATE TABLE #t(x INT PRIMARY KEY )
INSERT INTO #t VALUES (1)
SELECT Test1Col = x FROM #t
EXEC Test2
GO
EXEC Test1
GO
---------------------------------------
Regards,
Yan
***This posting is provided 'AS IS' with no warranties, and confers no
rights.*****


Mon, 05 Jul 2004 13:13:57 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Calling Stored Procedure that calls Stored Procedure in ASP

2. Problem with stored procedure that calls other stored procedures

3. Problem compiling stored procedure that calls another stored procedure

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

5. Using ODBC call rather than TSQL execute to call a stored procedure

6. RPC call occurs for each Stored Procedure call?

7. Problem in calling stored procedure stored in UTF-2 codeset DB

8. Stored Procedure calling Stored Procedure

9. Call a stored procedure from another stored procedure

10. Calling a stored procedure with parameters from another stored procedure

11. Calling a Stored Procedure from a Stored Procedure

12. How to call an Oracle Stored procedure from MSSQL Server Stored Procedure


 
Powered by phpBB® Forum Software