I am using SQL Server 2005. I am looking for opening an SQL connection, looping the collection and running the update request (stored procedure or parameterized query) with the data from the collection item, and then closing the connection.
What will give me the best performance and why?
It’s hard to say with certainty, since there are a number of factors that can affect performance. Theoretically, the stored procedure method should be faster.
, XML , . , , XML. Xquery, Open XML sp_XML_preparedocument XML .
SQL- . , .
.
, ( 1 2), . .
" proc", , . LINQ .
( ) , , . , , procs ( ) .
. , , , , , . , , DBA, , , , , , .
- . , , . , , . , , , SQL , . , SQL, .
( ), , .
, :
SqlCommand
SqlParameter
Parameters
Prepare
Usually stored procedures because the server can pre-optimize the execution plan. Although a well-written parameterized query is better than a general stored procedure.
Source: https://habr.com/ru/post/1706004/More articles:Использование асфальтоукладчика и носа вместе с нетипичной структурой каталогов - pythonTables ACCPAC - databaseFree Nhibernate (ClassMap) issue - c #Using AesCryptoServiceProvider in VB.NET - javaSilverlight XAML Binary Serialization Object - c #How can an Ajax callback understand that a user authentication session has ended? - jquerygetting serial number of USB keyboard under Windows - windowsКакой лучший способ предотвратить добавление записи, чей первичный ключ уже присутствует в mnesia? - databaseDriving a car with remote control with voltage drop - cAjax Control Toolkit Date Picker - Can I Not Choose a Day? - ajaxcontroltoolkitAll Articles