Hi All I have bunch of tables contains huge number records. All the tables are referring a primary key of table T1.Now.I have to write a stored procedure to delete the records in batches.I am new to SQL server programming .Please help me in writing this stored procedure Scenario: T1---primary key x1 T2- referential x1 T3-referential x1 T4-referential x1 Best Regards
Welcome to the forum! Something similar to this should get you started: SELECT "Starting to delete" WHILE @@ROWCOUNT > 0 BEGIN DELETE TOP (x number of rows) FROM ... WHERE... END