Well dont use while loop for inserting the records.. here is the wonderful function written by MVJ.I tested over at my end, your while loop took around 38 Sec for inserting 100000 records where as using the function it only take 13 sec. link for the function http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685&SearchTerms=Numbers,tabletry this Create PROCEDURE dbo.[insertloop](@str varchar(50) ,@num bigint , -- number of record@recordnum bigint,@counter bigint OUTPUT)ASinsert into NumTable select @Str,@num from(Select * From dbo.F_TABLE_NUMBER_RANGE(1,@recordnum)) As FSelect @counter =Max(Number) From NumTable
If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.