Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tilee001
Starting Member
4 Posts |
Posted - 2015-04-03 : 07:30:50
|
The following transaction runs, then reverts back after 10 mins. Any ideas I may have missed? The syntax looks right to me.Any help greatly appreciated. begin Tran [UpdateSundays]update ScanAssetInformation with (rowlock)set BusinessDate = dateadd(day,-2,BusinessDate)where datepart(weekday,BusinessDate) = 1commit tran [UpdateSundays] begin Tran [UpdateSaturdays]update ScanAssetInformation with (rowlock)set BusinessDate = dateadd(day,-1,BusinessDate)where datepart(weekday,BusinessDate) = 7commit tran [UpdateSaturdays] |
|
AuroraS
Starting Member
3 Posts |
Posted - 2015-04-03 : 12:54:41
|
In my testing it's working. I can not see the problem. |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2015-04-03 : 15:26:26
|
Check for some of these:a) There is some other process that runs and removes/reverts the data that you updated.b) If this is part of a larger query, see if there are other transactions that either rollback or has statements that effectively revert the data to the original.c) Before you open the transaction and after you have committed the transactions, check if the data has really been updated. Perhaps there is no data that meets the where clause conditions?Also, if you have only a single statement as in the examples you have posted, you don't need to open explicit transactions. Each statement implicitly is done in a transaction. |
|
|
|
|
|