Solved

Record open by another user

Posted on 2016-10-03
6
98 Views
Last Modified: 2016-10-03
Hello,
Is there any way we can Check whether in sql server the same record is opened by another user on another machine ?


Cheers
0
Comment
Question by:RIAS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 51

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 500 total points
ID: 41826359
Is there any way we can Check whether in sql server the same record is opened by another user on another machine ?
As far as I know you can't. Only way that I can think of is to have a column set to true every time somebody open the record and set it to false when nobody else has the record opened.
Ofc that if the record is locked then a SQL error will be raised when some other process is trying to read the record.
0
 

Author Comment

by:RIAS
ID: 41826363
And what happend if two users are trying to add the same new record at same time ?
Can anything be done about that
0
 
LVL 51

Expert Comment

by:Vitor Montalvão
ID: 41826365
And what happend if two users are trying to add the same new record at same time ?
It depends on your Primary Key definition and the existence of any Unique Index. If you have both or at least one of kind of those indexes then it will raise an error and the second record will be rolled back.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:RIAS
ID: 41826377
So it is all handled by default sql server setting.No settings are required from my side?
0
 
LVL 51

Accepted Solution

by:
Vitor Montalvão earned 500 total points
ID: 41826413
No settings are required from my side?
If you have corrected set the Primary keys and unique keys then the database engine will raise the errors when a duplicate records is being tried to be inserted.
0
 

Author Closing Comment

by:RIAS
ID: 41826424
Very clear and brilliant solution provided as always!
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question