Posted by Erland Sommarskog on 02/23/06 01:29
Madhivanan (madhivanan2001@gmail.com) 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@sommarskog.se
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
Navigation:
[Reply to this message]
|