Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Delete records fastest way??

Author  Topic 

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2011-08-10 : 01:44:57
Hi,

I have an Arraylist of 10000 records.Those records are composite key of a table, that I would like to delete.Is there a way to delete those records from table???

sample ArrayList record:
166,2008-08-08,1,5

166 -> VendorNo
2008-08-08 -> request date
1 -> Item id
5 -> pack id

Sachin.Nand

2937 Posts

Posted - 2011-08-10 : 01:57:51
What do you mean by fastest way ?

PBUH

Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2011-08-10 : 02:14:48
I mean, can I have something like this?

delete from table where id in ...
Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2011-08-10 : 02:17:02
if I delete in a LOOP, It would be much more slower,am I right?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-08-10 : 02:22:59
It depends on the number of records to delete, and in comparison to the number of all rows in table.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2011-08-10 : 02:24:45
Num of records to delete is max 10000 and num of rows in table is growing
Go to Top of Page
   

- Advertisement -