Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7501939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:42:01+00:00 2026-05-29T20:42:01+00:00

Table is huge. For testing application I want to delete all, except 1000 records

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:42:03+00:00Added an answer on May 29, 2026 at 8:42 pm

    count the numberOfRecordsOnYourDB and do:

    set ROWCOUNT  (numberOfRecordsOnYourDB - 1000 )
    delete from hugetable
    Go
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to get all the records from a huge table where any of
I have a huge table and I want simple sorting. It could be so
I have a scripts that retrieves huge data on a table. I want to
I have a table with huge data( say millions of records, its just a
So I have this (huge) table , classed with css (big_conv_tbl) . All empty
I have a huge table full of records and with PHP I'm making a
I have huge table with 1 million records, i would like to modify some
I have a Person table with huge number of records(for about 16 million), and
I have a query which take data from 5 huge table, could you please
I have a huge table to work with . I want to check if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.