Home > Archive > Microsoft SQL Server forum > November 2005 > An INSERT EXEC statement cannot be nested error.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author An INSERT EXEC statement cannot be nested error.
Scarab

2005-11-28, 3:24 am

Hi,all,
When I use following sql, an error occurs:
insert into #tmprep
EXECUTE proc_stat @start,@end

There is a "select * from #tmp " in stored procedure proc_stat, and the
error message is :

Server: Msg 8164, Level 16, State 1, Procedure proc_stat, Line 42
An INSERT EXEC statement cannot be nested.

What's the metter? Any help is greatly appreciated. Thanks


Jens

2005-11-28, 3:24 am

Could you provide some code for use. A adhoc solution would be to
consider if you can use a UD(T)F for that to retrieve the data from.

HTH, jens Suessmeyer.

Erland Sommarskog

2005-11-28, 3:24 am

Scarab (pest9998@hotmail.com) writes:
> When I use following sql, an error occurs:
> insert into #tmprep
> EXECUTE proc_stat @start,@end
>
> There is a "select * from #tmp " in stored procedure proc_stat, and the
> error message is :
>
> Server: Msg 8164, Level 16, State 1, Procedure proc_stat, Line 42
> An INSERT EXEC statement cannot be nested.
>
> What's the metter? Any help is greatly appreciated. Thanks


Yes, that's a restriction with INSERT-EXEC. See this article for
alternative solutions: http://www.sommarskog.se/share_data.html.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com