June 28, 2010 at 5:09 am
I develope in C# and would like to use tsql transaction in the database instead of .NET TransactionScope etc. If I am submitting one record to several tables, I am able to do this. The problem is how best can I submit batch records (or say more than 2 to 100) using tsql stored procedure? I normally use transactionscope and foreach statement in C#. I desperately need help, or I am missing something?
June 28, 2010 at 5:21 am
You better to stay with using TransactionScope :-).
It is not quite clear what are you trying to do in one transaction.
You can submit batch of records into stored proc in XML format, parse it inside of stored proc and write everything into the database in a single transaction. But why do you really want to do it?
June 28, 2010 at 7:02 am
If you are using SQL 2008 and (I believe) .Net 3, you can use the table valued parameter.
http://www.codeproject.com/KB/cs/CSharpAndTableValueParams.aspx
http://msdn.microsoft.com/en-us/library/bb675163.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply