Skip to Content
0

SQL Lock record

Oct 21, 2016 at 07:53 PM

110

avatar image

Is it possible to lock a record with a SQL command as one can do with MSSQL and WITH(ROWLOCK,UPDLOCK) or MYSQL and FOR UPDATE or LOCK IN SHARE MODE?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Marius Cere Nov 03, 2016 at 02:46 PM
0

Anybody have a solution or suggestion?

Share
10 |10000 characters needed characters left characters exceeded
Igor Golobrodkiy Nov 04, 2016 at 06:26 AM
0

I use the transaction to lock record

BEGIN TRAN;

UPDATE table SET field1=field1 WHERE key=xxxx;

This record is locked until

ROLLBACK WORK; or COMMIT WORK;

Share
10 |10000 characters needed characters left characters exceeded
Marius Cere Nov 04, 2016 at 12:03 PM
0

Thanks Igor, but I tried into Arc32 but it's not functionnal.

1. Open my data dictionary with Arc32

2. On list of table included in datadictionary, double click on one table

3. Open a Windows of SQL utility and execute this SQL:

BEGIN TRAN;
UPDATE MyTable SET Field1=Field1 WHERE UniqueField=1;

4. Returned in the window where my table is open and try to modify a record where the information UniqueField = 1 and save the change. The record is saved and I never received the error message 5035.

Share
10 |10000 characters needed characters left characters exceeded
Igor Golobrodkiy Nov 04, 2016 at 12:29 PM
0

Marius, I used this a lot of times. I think you need to save this connect as open


снимок.png (31.4 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Igor, I tried this!!

0
Michael Loop
Nov 16, 2016 at 07:50 PM
0

Marius,

The help files state that, "Using SQL, it is not possible to control locking explicitly from an application". However, it is possible to create an explicit lock using the Advantage Client Engine, the Tdataset Descendant, or the .NET Data Provider. For other APIs such as ODBC and JDBC, you would need to use a technique similar to the one suggested by Igor.

I hope this helps,

Mike Loop - SAP Product Support

Share
10 |10000 characters needed characters left characters exceeded