Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
for ex: I have 5000 records in a table I want to delete any 1000 records in a table
without using Top and where Clause
how I can help me.
Posted
Updated 8-Oct-15 22:48pm
v2
Comments
[no name] 9-Oct-15 3:57am    
On which basis/condition, do you want to delete 1000 records. Whether top 1000 or below 1000 or any other condition are there. And is there any primary key present in that table.
Gajana Paralkar 9-Oct-15 5:13am    
delete any 1000 records records in a table no condition but don't use Top and where Clause. no primary key

want to delete 1000 records how?

The problem is that unless you have a WHERE clause or similar SQL will delete all records - so to restrict your input to just "any 1000 records" you would need some kind of filtering.

I'm pretty sure that you are trying to do something that would be better handled elsewhere, because deleting random records is not a function SQL is normally used for.
Id'd sit back and think about exactly what you are trying to do and why you think SQL is a good vehicle for this before continuing.
 
Share this answer
 
Without giving condition you can't delete the required records, there should be some condition for deleting records, without that means it's delete all the records.

As "OriginalGriff" Suggested recheck your requirement and come back with the proper requirement.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900