LOCKTABLE question

Hi All What is the difference between LOCKTABLE function in native server and sql server? And what is the RECORDLEVELLOCKING function for? Only to show what server we are running? sp_lock shows that lock created is still tablebased

The quick answer is that LOCKTABLE on SQL does not do any locking immediately but changes locking behaviour thereafter on the table. Also, a table once locked has ROWLOCKs placed for all activity on it. On Navision Server LOCKTABLE immediately locks the table (or could error) and the lock is always a table lock. There are more details to this but try doing a search for LOCKTABLE, and you might look at: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=5531 RECORDLEVELLOCKING tells you if the server you are running against supports record locking. Currently this implies the use of Navision Server vs. SQL Server; but if in future record locks are implemented in Navision Server, for example, this would no longer hold. It should be used for its intended purpose.

Thanks Robert

On Navision Server LOCKTABLE immediately locks the table ? More specifically this tells navision to lock the table upon access. e.g. table.LOCKTABLE; table.FIND(’-’); ← This is when the lock is applied. This is not nornally an issue but worth knowing. Check out the trouble shooting course for details.

Tim, that is the SQL behaviour, in order to lock only the record(s) affected by the FIND read. Navision Server (or the native database if you like) locks immediately. Try it with 2 clients using the debugger. You’ll see that one LOCKTABLE call will block once the other one is executed, without getting to the FIND in either case.