Re: Loop / Cursor help
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Wed, 22 Feb 2006 23:29:17 +0000 (UTC)
Madhivanan (madhivanan2001@xxxxxxxxx) writes:
Why does select * from @t returns 32 rows?
I expected it to return 28 rows only
Watch this part of the output:
(1 row(s) affected)
(1 row(s) affected)
(2 row(s) affected)
(4 row(s) affected)
(8 row(s) affected)
(16 row(s) affected)
See what is going on? David is doubling the number of rows he inserts
each time. That way the loops can run fewer iterations and be faster.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- Follow-Ups:
- Re: Loop / Cursor help
- From: Madhivanan
- Re: Loop / Cursor help
- References:
- Loop / Cursor help
- From: woodfoot
- Re: Loop / Cursor help
- From: David Portas
- Re: Loop / Cursor help
- From: woodfoot
- Re: Loop / Cursor help
- From: David Portas
- Re: Loop / Cursor help
- From: Madhivanan
- Loop / Cursor help
- Prev by Date: Re: Backup users
- Next by Date: Re: Tricky SQL question
- Previous by thread: Re: Loop / Cursor help
- Next by thread: Re: Loop / Cursor help
- Index(es):
Relevant Pages
|