Hello,
I want to share my experiences about using insert into exec which may
help others .
Using SQL Server 2000, SP3 .
Two Proceduers - Parent SP caliing a Child SP (nested ) . No Explicit
transactions .
I have defined a # table in Parent SP and calling a Child SP like this
insert into #temp exec childsp ......
Child SP has Select * from local # temp table ( local to child SP
) as the last statement .
When number of records are less ( around 1000 - 5000) Parent SP
executes but slow .
When the Child SP returns higher number of rows ( 1,00,000 or more )
the SP will be running for hours with out completion .
Although executing the child SP , with exec ChildSP .... with same
parameters it is completed in 2 mins for 3,00,000 rows .
Resolution : - Define a temp table (say #tempChild ) in the Parent SP
..
In the Child SP instead of select * replace with insert into
#tempChild select * from ...
Also note that this problem is not noticed in SQL 2000 Server with SP4
..
This may be due to SP executing in implicit transactions . 1 5533
(ma******@gmail.com) writes:
I want to share my experiences about using insert into exec which may
help others .
Using SQL Server 2000, SP3 .
Two Proceduers - Parent SP caliing a Child SP (nested ) . No Explicit
transactions .
I have defined a # table in Parent SP and calling a Child SP like this
insert into #temp exec childsp ......
Child SP has Select * from local # temp table ( local to child SP
) as the last statement .
When number of records are less ( around 1000 - 5000) Parent SP
executes but slow .
When the Child SP returns higher number of rows ( 1,00,000 or more )
the SP will be running for hours with out completion .
Although executing the child SP , with exec ChildSP .... with same
parameters it is completed in 2 mins for 3,00,000 rows .
Resolution : - Define a temp table (say #tempChild ) in the Parent SP
.
In the Child SP instead of select * replace with insert into
#tempChild select * from ...
For further discussion on the problem of passing data between stored
procedures, there is an article on my web site: http://www.sommarskog.se/share_data.html.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nick Jacobson |
last post by:
This works fine:
x = 1
def execfunc():
print x
execfunc()
So why doesn't this?
s = \
|
by: Steve Thorpe |
last post by:
Hi
I am trying to write a report that calculates the average number of sales
over 7, 14, 31 and 365 days for each hourly period of the day. the problem
is it takes over 4 minutes to run.
...
|
by: Steve Thorpe |
last post by:
Hi
I am trying to write a report that calculates the average number of sales
over 7, 14, 31 and 365 days for each hourly period of the day. the problem
is it takes over 4 minutes to run.
...
|
by: Steve Thorpe |
last post by:
Hi.
I have two sql servers and have ran exec sp_addlinkedserver 'ACSPSM', N'SQL
Server' to link one to the other and also vise versa.
Each server has two users permissioned.
My problem is...
|
by: Not Me |
last post by:
Hi,
I have a stored procedure, that works perfectly when run from the query
analyser, however if I run it through access vba, (using exec) I get a
runtime error 208: invalid object name...
|
by: Scarab |
last post by:
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 :...
|
by: Scarab |
last post by:
Hi all,
When I use following sql to get data in stored procedure, error occurs:
insert into #tmp
EXECUTE dbo.prc_1 @date1,@date1
Here is the source code, Thanks
CREATE TABLE (
NULL ,
...
|
by: TPJ |
last post by:
I have the following code:
-----------------------------------
def f():
def g():
a = 'a' # marked line 1
exec 'a = "b"' in globals(), locals()
print "g: a =", a
|
by: carl.dhalluin |
last post by:
Hello
I am completely puzzled why the following exec code does not work:
mycode = "import math\ndef f(y):\n print math.floor(y)\nf(3.14)"
def execute():
exec mycode
execute()
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |