I'm trying to run a script against a database which seems to max out the CPU usage on the server. When I run the same script against a copy of the database it runs fine. Is there some sort of permission or database setting causing this to happen? Here is the script:SELECT DD.ID, DD.transtype, DD.datum, DD.docdate, DD.vervdatfak, DD.project, DD.res_id INTO dbo.AgingDistDate_51A79C0011F33E46B1DCF306C7EE90A3FROM (( SELECT bs.ID, gb.transtype, gb.datum, gb.docdate, gb.vervdatfak, gb.project, gb.res_id FROM Banktransactions bs WITH(NOLOCK) INNER JOIN gbkmut gb WITH(NOLOCK) ON (bs.sysguid = gb.banktransactionguid AND bs.sysguid IS NOT NULL AND gb.banktransactionguid IS NOT NULL) AND (gb.reknr = bs.ledgeraccount AND bs.ledgeraccount IS NOT NULL AND gb.reknr IS NOT NULL) AND ISNULL(gb.debnr, '') = ISNULL(bs.debtornumber, '') AND (gb.bkstnr = bs.entrynumber AND bs.entrynumber IS NOT NULL AND gb.bkstnr IS NOT NULL) WHERE bs.Type = 'S' AND (bs.CreditorNumber IS NULL AND bs.DebtorNumber BETWEEN ' 100' AND '802302' )) UNION ALL (SELECT bw.ID, gb.transtype, gb.datum, gb.docdate, gb.vervdatfak, gb.project, gb.res_id FROM Banktransactions bw WITH(NOLOCK) INNER JOIN gbkmut gb WITH(NOLOCK) ON ISNULL(gb.debnr, '') = ISNULL(bw.debtornumber, '') AND ISNULL(gb.faktuurnr,'') = ISNULL(bw.invoicenumber,'') AND (gb.bkstnr = bw.entrynumber AND gb.bkstnr IS NOT NULL AND bw.entrynumber IS NOT NULL) AND (gb.reknr = bw.OffsetLedgerAccountNumber AND gb.reknr IS NOT NULL AND bw.OffsetLedgerAccountNumber IS NOT NULL) AND gb.transtype <> 'V' WHERE bw.Type = 'W' AND (bw.CreditorNumber IS NULL AND bw.DebtorNumber BETWEEN ' 100' AND '802302' ))UNION ALL(SELECT bw.ID, gb.transtype, gb.datum, gb.docdate, gb.vervdatfak, gb.project, gb.res_id FROM Banktransactions bw WITH(NOLOCK) INNER JOIN Banktransactions ba ON ba.entrynumber = bw.entrynumber AND ba.offsetledgeraccountnumber = bw.offsetledgeraccountnumber AND ba.type = bw.type AND ba.invoicenumber = bw.invoicenumber AND ba.creditornumber <> bw.creditornumber INNER JOIN gbkmut gb WITH(NOLOCK) ON IsNull(gb.crdnr, '') = IsNull(ba.creditornumber, '') AND ISNULL(gb.faktuurnr,'') = ISNULL(ba.invoicenumber,'') AND (gb.bkstnr = ba.entrynumber AND gb.bkstnr IS NOT NULL AND ba.entrynumber IS NOT NULL) AND (gb.reknr = ba.OffsetLedgerAccountNumber AND gb.reknr IS NOT NULL AND ba.OffsetLedgerAccountNumber IS NOT NULL) AND gb.transtype <> 'V' WHERE bw.Type = 'W' AND (bw.CreditorNumber IS NULL AND bw.DebtorNumber BETWEEN ' 100' AND '802302' ))) DD