title: C# & SQL Server - best way to delete multiple Rows in "one go" using a stored procedure
body: <p>I know there's many of the same subjected question here in SO, my question is if I want to delete say around 1K rows rather few, given a <code>List&lt;int&gt;</code> of <code>RecordID</code>, I could avoid using a <code>DataTable</code>, and send the list translated into a statement:</p>
  
  <pre><code>string ParmRecordsToDelete_CsvWhereIN = "("
  for(int CurIdx=0; CurIdx &lt; RecIdsToDelete.Count; CurIdx++)
  {
    ParmRecordsToDelete_CsvWhereIN += RecIdsToDelete[CurIdx] + ", ";
    //this method to create passed parameter 
    //logic to remove on last Coma on last Index..
  
    //or use stringJoin and somehow remove the last coma 
  }
  ParRecordsToDelete_CsvWhereIN +=")";
  </code></pre>
  
  <p>This will create something Like "('1','2','3'......)"</p>
  
  <p>and then create a <code>SqlCommand</code> to call a stored procedure:</p>
  
  <pre><code>Delete * From @TblName WHERE @ColName IN @RecordsToDeleteCsvWhereIN
  </code></pre>
  
  <p>Is this an efficient approach? Is there a limit to the length of single parameter? I guess it's the <code>N/VARCHAR(MAX)</code> length.</p>
  
  <p>I guess if it's not a kinda hackish solution it would not be limited with length...</p>
  
  <p>What would be the best fast solution, or am I on the right track as it is?</p>