Hi all
I need to delete records from a table in batches of 5000.
The problem is that the id column for the table contains duplicates, so when i try this:
delete table1 from (select top 5000 * from table1) as t1 where table1.testid = t1.testid
it ends up deleting more than just 5000 rows.
I think i might need to use rowcount but im not really experienced in tsql so any assitance would be v. much appreciated!
Thanks
Di
I need to delete records from a table in batches of 5000.
The problem is that the id column for the table contains duplicates, so when i try this:
delete table1 from (select top 5000 * from table1) as t1 where table1.testid = t1.testid
it ends up deleting more than just 5000 rows.
I think i might need to use rowcount but im not really experienced in tsql so any assitance would be v. much appreciated!
Thanks
Di