Click here to Skip to main content
15,885,537 members
Home / Discussions / Database
   

Database

 
GeneralRe: how to select last row on second CTE Pin
Eddy Vluggen29-Sep-14 5:26
professionalEddy Vluggen29-Sep-14 5:26 
GeneralRe: how to select last row on second CTE Pin
Jörgen Andersson29-Sep-14 5:50
professionalJörgen Andersson29-Sep-14 5:50 
QuestionMS Server - Lock a record Pin
hansoctantan26-Sep-14 3:48
professionalhansoctantan26-Sep-14 3:48 
QuestionRe: MS Server - Lock a record Pin
ZurdoDev26-Sep-14 4:22
professionalZurdoDev26-Sep-14 4:22 
AnswerRe: MS Server - Lock a record Pin
PIEBALDconsult26-Sep-14 4:24
mvePIEBALDconsult26-Sep-14 4:24 
AnswerRe: MS Server - Lock a record Pin
Eddy Vluggen26-Sep-14 6:15
professionalEddy Vluggen26-Sep-14 6:15 
AnswerRe: MS Server - Lock a record Pin
jschell26-Sep-14 10:44
jschell26-Sep-14 10:44 
AnswerRe: MS Server - Lock a record Pin
Wendelius30-Sep-14 8:28
mentorWendelius30-Sep-14 8:28 
If I understood your question correctly, you're wondering if session 1 can read the data that session 2 is locking. If this is the concern then the answer in many cases is no.

Consider the following scenario:
Session 1                                       Session 2
---------------------------------------------   -----------------------------------------------------
Select record A, field named SomeValue is 1

                                                Select record A, field named SomeValue is 1

Begin transaction

Update record A, 
   field named SomeValue is set to 2, 
   an eXclusive lock is taken

                                                Select record A, record is locked, session 2 waits

Some other modifications

                                                Session 2 still waits

Commit the transaction, lock is freed

                                                Session 2 now gets the answer, 
                                                   field named SomeValue is 2 
                                                   (the value session 1 updated)


Now the actual sequence varies depending if auto-commit is on and so on. Also you should know that if row versioning is in effect, then the behaviour is far different. For more information, read Data versioning in SQL Server using row versions[^]
QuestionProtect my sql server database Pin
dilkonika23-Sep-14 15:44
dilkonika23-Sep-14 15:44 
AnswerRe: Protect my sql server database Pin
Mycroft Holmes23-Sep-14 16:57
professionalMycroft Holmes23-Sep-14 16:57 
GeneralRe: Protect my sql server database Pin
Richard Deeming24-Sep-14 1:27
mveRichard Deeming24-Sep-14 1:27 
AnswerRe: Protect my sql server database Pin
Eddy Vluggen23-Sep-14 21:10
professionalEddy Vluggen23-Sep-14 21:10 
GeneralRe: Protect my sql server database Pin
dilkonika24-Sep-14 3:13
dilkonika24-Sep-14 3:13 
GeneralRe: Protect my sql server database Pin
Eddy Vluggen24-Sep-14 6:21
professionalEddy Vluggen24-Sep-14 6:21 
GeneralRe: Protect my sql server database Pin
dilkonika24-Sep-14 13:30
dilkonika24-Sep-14 13:30 
GeneralRe: Protect my sql server database Pin
Eddy Vluggen25-Sep-14 1:53
professionalEddy Vluggen25-Sep-14 1:53 
AnswerRe: Protect my sql server database Pin
Corporal Agarn24-Sep-14 4:33
professionalCorporal Agarn24-Sep-14 4:33 
GeneralRe: Protect my sql server database Pin
dilkonika24-Sep-14 6:18
dilkonika24-Sep-14 6:18 
AnswerRe: Protect my sql server database Pin
data modeling guy29-Sep-14 6:58
data modeling guy29-Sep-14 6:58 
AnswerRe: Protect my sql server database Pin
Wendelius30-Sep-14 8:59
mentorWendelius30-Sep-14 8:59 
QuestionSQL Server : Multiple relationship for the same field Pin
dilkonika23-Sep-14 7:29
dilkonika23-Sep-14 7:29 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Wendelius23-Sep-14 8:04
mentorWendelius23-Sep-14 8:04 
GeneralRe: SQL Server : Multiple relationship for the same field Pin
dilkonika23-Sep-14 8:14
dilkonika23-Sep-14 8:14 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Wendelius23-Sep-14 8:33
mentorWendelius23-Sep-14 8:33 
AnswerRe: SQL Server : Multiple relationship for the same field Pin
Mycroft Holmes23-Sep-14 14:19
professionalMycroft Holmes23-Sep-14 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.