|  | Posted by akej via SQLMonster.com on 06/13/21 11:17 
Hi, suppose i have 3 tables
 main table
 
 CREATE TABLE table1 (
 [t1ID] [int] primary key ,
 [t1Name] nvatchar(50) NOT NULL,
 ............................
 
 )
 
 and connections tables (t1ID is  a foreign key in all connection tables)
 
 CREATE TABLE tbl2 (
 [t1ID] [int] not null,
 [gID] [int] not null
 PRIMARY KEY (t1ID, gID)
 )
 
 CREATE TABLE tbl3 (
 [t1ID] [int] not null,
 [pID] [int] not null
 PRIMARY KEY (t1ID, pID)
 )
 
 *******************************************************
 
 t1ID CLISTERED INDEX
 in othre tables each primary key is clustered.
 
 gID and pID are keys from other table: gtable, ptable
 
 
 
 Now in case one row was deletes from table1 i need to delete all t1ID's
 from the connection tables (each of connection may have e.g. 200000 rows).
 If u use delete on cascade it's take a lot of time, i want to delete let's
 say 1000 rows till all irrelevant rows will be deleted.
 
 How To accomplish this??
 Thanks.
 
 --
 Message posted via http://www.sqlmonster.com
  Navigation: [Reply to this message] |