Table is huge. For testing application I want to delete all, except 1000 records from table. 1000 lucky records don’t have identifier that can given as:
DELETE FROM HUGE_TABLE t WHERE t.IDENTIFIER!='LUCKY'
What is best way in one sql statement?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
count the numberOfRecordsOnYourDB and do:
This will delete records from your table but stop processing after the specified number of rows.
oh and don’t forget to set the ROWCOUNT back to a big value, or just open a new connection to do the other tasks