Deleting Multiple Rows

From: Guadala Harry (GMan_at_NoSpam.com)
Date: 08/16/04


Date: Mon, 16 Aug 2004 14:05:13 -0700

Suppose I have a very simple table (just one column of integers, not null,
for the sake of simplicity).

I have an application that interacts with this table (in a SS2K database)
via ADO.NET.

There will periodically be the need to arbitrarily delete 300-500 out of
150,000 rows from this table (arbitrarily - meaning that the integers to be
deleted do not necessarily fall in a range).

My application has the logic that determines which of the rows need to be
deleted.

What is an efficiant and recommended way to get rid of these rows?

Should the app execute a stored procedure 300 times - once for each row to
be deleted? I'd hate to do that if I don't have to (transaction or not). Is
there a way to pass to the stored procedure the list of 300 integers that
need to be deleted and then the stored procedure executes only one DELETE
statement that does the job? I can pass the list to the SP - but how to get
the DELETE statement to use it? Is there a better way altogether?

Thanks!

-G



Relevant Pages

  • RE: No hit on breakpoint in webservice
    ... It is the line of code where I call the stored procedure in SQL ... The stored procedure executes OK. ... >>I have two web services on a local machine, ... >>How can I debug the web service visual basic code? ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Debugging
    ... Does anyone know how to use the T-SQL Debugger built in? ... watch how a stored procedure executes but when I right-click the sproc and ... I can run the stored procedure within a job without an error, ...
    (microsoft.public.sqlserver.programming)
  • Re: Deleting Multiple Rows
    ... FROM tbl_orders o left outer join to_delete td ... > I have an application that interacts with this table (in a SS2K database) ... > Should the app execute a stored procedure 300 times - once for each row to ... > need to be deleted and then the stored procedure executes only one DELETE ...
    (microsoft.public.sqlserver.programming)
  • Re: Identity columns with ClientDataSets?
    ... > Thank you, Kevin, the stored procedure is a godsend and brilliant in its ... > simplicity. ...
    (borland.public.delphi.database.ado)
  • Dates problems
    ... I've a dialog form which interacts with a stored procedure to select a range ... A command moves the data to a report, in theory, but it's not ... The report is blank, however, when using the Query ...
    (microsoft.public.sqlserver.datamining)