Home Forums SQL Server 7,2000 General Problem with delete query across two databases RE: Problem with delete query across two databases

  • Is column oid indexed in database 1 ? If so, it might run better as an EXISTS subquery:

    DELETE FROM database2.dbo.transactions del

    WHERE EXISTS

    (SELECT * FROM database1.dbo.transactions TR WHERE del.oid = TR.oid)

    Also, are there any foreign key constraints that reference the table being deleted from ? That can seriously impact performance if SqlServer has to ensure RI is maintained for each row deleted.