How to do the Bulk delete in Sql table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gunapri
    New Member
    • Feb 2008
    • 1

    How to do the Bulk delete in Sql table?

    In my database i'm having the table with 9 million record,I want to delete some record from this based on some condition.I tried to delete records but its taking so much time.,tell me how can i do bulk delete in this..,
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by gunapri
    In my database i'm having the table with 9 million record,I want to delete some record from this based on some condition.I tried to delete records but its taking so much time.,tell me how can i do bulk delete in this..,
    I don't think there's a faster way. You could try to:

    1. Rearrange your WHERE clause.
    2. Create index for those columns in your condition.
    3. Try a:

    Code:
    select * into temp_table from yourtable where IncludeThisRecord = 'YES'
    drop table yourtable
    sp_rename temp_table, YourTable
    The catch: TRIGGERS, DEFAULTS, CONSTRAINTS, etc are not inherited by the new table.

    Good luck

    -- CK

    Comment

    Working...