Answer by Fatherjack
what version of SQL Server you are working with may have an effect here. You can use `TOP n` or `SET ROWCOUNT` to control the number of rows to delete on each pass. This question has a relevant answer...
View ArticleComment by Pavel Pawlowski on Fatherjack's answer
I only add, that for heap it's hard to defiine what is first 5 millions as you have no order guaranteed in the heap. You will have to provide some correct criteria, which will identify those 5 millions...
View ArticleComment by Pamz on Fatherjack's answer
Thanks for the reply. My version is sql 2008. But let me explain it a bit further; I want to delete first top 5 million in order of insertion. I already had it covered for a clustered indexed table and...
View ArticleComment by Pavel Pawlowski on Fatherjack's answer
You cannot guarantee the order of insertion during select unless you have an IDENTITY (or some time stamp column which has different timestamp for each row) column in the table. If you hwave identity...
View ArticleComment by Pamz on Fatherjack's answer
That exactly what I was thinking. But you hinted some undocumented functions. can they help?
View ArticleComment by Pavel Pawlowski on Fatherjack's answer
Those undocumented functions can help you get values in order how they are physically stored on pages, however again this does not guarantee the order of insertion.
View ArticleComment by Pamz on Fatherjack's answer
Thanks for confirming. It seems, a lot of manual work coming our way. Fingers crossed! trying to find the source files.
View ArticleAnswer by Pamz
I have just got the good news that source text files for the heap are available at remote site. Those would be approximately 100K size each. So here it is what we are planning to do A.Create a...
View ArticleAnswer by Fatherjack
what version of SQL Server you are working with may have an effect here. You can use `TOP n` or `SET ROWCOUNT` to control the number of rows to delete on each pass. This question has a relevant answer...
View ArticleComment by Pavel Pawlowski on Pavel Pawlowski's answer
I only add, that for heap it's hard to defiine what is first 5 millions as you have no order guaranteed in the heap. You will have to provide some correct criteria, which will identify those 5 millions...
View ArticleComment by Pamz on Pamz's answer
Thanks for the reply. My version is sql 2008. But let me explain it a bit further; I want to delete first top 5 million in order of insertion. I already had it covered for a clustered indexed table and...
View ArticleComment by Pavel Pawlowski on Pavel Pawlowski's answer
You cannot guarantee the order of insertion during select unless you have an IDENTITY (or some time stamp column which has different timestamp for each row) column in the table. If you hwave identity...
View ArticleComment by Pamz on Pamz's answer
That exactly what I was thinking. But you hinted some undocumented functions. can they help?
View ArticleComment by Pavel Pawlowski on Pavel Pawlowski's answer
Those undocumented functions can help you get values in order how they are physically stored on pages, however again this does not guarantee the order of insertion.
View ArticleComment by Pamz on Pamz's answer
Thanks for confirming. It seems, a lot of manual work coming our way. Fingers crossed! trying to find the source files.
View ArticleAnswer by Pamz
I have just got the good news that source text files for the heap are available at remote site. Those would be approximately 100K size each. So here it is what we are planning to do A.Create a...
View Article
More Pages to Explore .....