title: Count the number of deleted rows
body: <p>How do i count the number of deleted rows while using Stored procedure in SQL server?<br>
  i Tries the Following:</p>
  
  <pre><code>ALTER procedure [dbo].[P_DeleteNames] @xmlDoc nText
  as
  declare @handle int 
  exec sp_xml_preparedocument @handle output, @xmlDoc
  create table #deletename(nameId int) 
  insert INTO #deletename(nameId)
  SELECT NameID
  from openxml(@handle,'/dsNames/dtNames',2)
  with (nameID int)
  
  set NOCOUNT OFF
  set ROWCOUNT 0
  delete FROM NamesTable where name_ID in(select nameID from #deletename)  
  exec sp_xml_removedocument @handle 
  </code></pre>
  
  <p>It always returns the number twice the deleted rows. I can't figure it out</p>