I want to lock (read-only) a record with an SQL statement.
How can I do that ?
I'm not an expert in sql....
:(
Printable View
I want to lock (read-only) a record with an SQL statement.
How can I do that ?
I'm not an expert in sql....
:(
is it possible do to that with a select statement ??
Yeah, with SQL Server you can put (UPDLOCK) after the table name in the FROM clause to lock the data you've selected until you update it.
What database are you using?
That's complicated..
My database is on an AS/400 server.
I'm using an activeX called ActiveObject/400
With this activeX , there's a control wich can be use to send sql commands on the server. This is why I wanted to know if it was possible to do so...
Maybe I should use a ADO or something like this to send my command...
Thanks for any help:)
Locking is not supported by standard SQL - there may be extensions that support it (as with SS7) but it is application specific. The locking is almost always defined by the database engine and can be passed off to the driver (e.g. OLE DB or ODBC). It is not possible to give you an outright answer because it depends upon your specific database.
Cheers,
P.
that's what I thought, but I wanted to be sure that it was impossible to do this with a standard sql command..
thanks for help :)
But I heard that it was a pissibility to use locking with the command Set Transaction ...
But Ì don't know much more about this command..
BEGIN TRANSACTION starts a transaction and COMMIT ends it. You could try these in your SQL, everything must be done in the same session though.
Hi,
I think you will find that TRANSACTIONS do not neccessarily lock the records. Without going into too much detail you would need to consider the Transactional Level being enforced.