简体   繁体   中英

query rollback policies in sql server 2008 r2

I have a query that consists of some inserts and updates, something like this

   Insert Into #TempTable (...) Select top (1000) * from T where ....

   Update T2 Set c1=...,c2=... where w1

   Update T2 Set c1=...,c2=... where w2

   Update T2 Set c1=...,c2=... where w2

I run this query from a C# App. Each part of this query could be got time out because of heavy load on server, I wanna know that if one part of query got time out (for example second update), all prior queries (Insert and first update) would be rollback by Sql Server engine?

After opening the SqlConnection at your code, do SqlCommand.CommandTimeout = 0; , This will prevent timeout errors causing by .net C# side.

If you are creating SqlDataAdapter by using the sqlcommand you set the timeout to 0, make sure that: SqlDataAdapter.SelectCommand.CommandTimeout=0 after creation by debugging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM