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 |
|
rudesyle
Posting Yak Master
110 Posts |
Posted - 2007-09-11 : 09:26:46
|
| Hi guys. I just cracked open a clients Sql 2005 database, and notice that the people who developed this use transactions in simple select statements in stored procedures (no update,del,or ins).I've never seen this before. Is there a good reason to do so? I mean, there's no database modification going on, so I see no reason to do this? |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-09-11 : 10:00:50
|
| A single SELECT statement is atomic ...... have they got multiple Select statements within the Transaction?Kristen |
 |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2007-09-11 : 10:17:26
|
| No reason, A lot of times I see people use a pre-designed template for all their stored procedures that start with the begin tran syntax. That's probably all this is, it's just what the programmers were used to. There is no need for it though. |
 |
|
|
rudesyle
Posting Yak Master
110 Posts |
Posted - 2007-09-11 : 11:10:14
|
quote: Originally posted by Kristen A single SELECT statement is atomic ...... have they got multiple Select statements within the Transaction?Kristen
Usually, but I've seen some singles too. Also, I see them enclose CTE's within a transaction. What sense does this make if no data is being updated? |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|