i have a table having 4000 (four thousand) records and now i want to delete 3000 of them as i don't need them, these records have primary key as id which is ofcourse unique.
can anyone tell me how can i delete these records with one query.
if their is any other method please let me know.
So is there any special criteria which distiguishes these 3000 records from the other records. If there is, you can use that clause to delete the required rows. If this is just a mass delete and if your primary key is ordered, you can delete the rows based on the value of primary keys.
no there is no pattern and i have primary key to distinguish those records and i have to delete them randomly.
e.g. from 1-4000 series, i have to delete 2-7, 9-11, 25-36, 40, 45, 78 and so on, without any pattern.
If you don't care about the values which get deleted, then why not just use the method suggested by me above? If not, then you need to know Transact SQL to generate random numbers and delete entries with those primary keys.