Detect isolation level (transaction type) in C/AL

mentat
Member Posts: 5
Hello,
is it possible to detect current isolation level in C/AL?
I have this problem. CURRENTTRANSACTIONTYPE always return TRANSACTIONTYPE::UpdateNoLocks. However it doesn't say if it is still BROWSE isolation level (i.e. no INSERT, MODIFY, DELETE operations occur) or isolation level is already SERIALIZABLE.
is it possible to detect current isolation level in C/AL?
I have this problem. CURRENTTRANSACTIONTYPE always return TRANSACTIONTYPE::UpdateNoLocks. However it doesn't say if it is still BROWSE isolation level (i.e. no INSERT, MODIFY, DELETE operations occur) or isolation level is already SERIALIZABLE.
0
Comments
-
You mean "how to find out that write transaction was started?" I think there is no C/AL for that. But may be someone will find way around...0
-
You can use DBCC to get the current isolation level for the active connnection on SQL
EXAMPLE CODE:
SET NOCOUNT ON
CREATE TABLE #Options (
[Set Option] VARCHAR(50),
[Value] VARCHAR(50))
INSERT INTO #Options
EXEC ('DBCC USEROPTIONS WITH NO_INFOMSGS')
Select * from #Options
Where [Set Option] = 'isolation level'
DROP TABLE #Options
SET NOCOUNT OFF
GO
You could take this example and create a stored procedure. Then use ADO to call it from NAV.There are no bugs - only undocumented features.0 -
bbrown wrote:You can use DBCC to get the current isolation level for the active connnection on SQL
EXAMPLE CODE:
SET NOCOUNT ON
CREATE TABLE #Options (
[Set Option] VARCHAR(50),
[Value] VARCHAR(50))
INSERT INTO #Options
EXEC ('DBCC USEROPTIONS WITH NO_INFOMSGS')
Select * from #Options
Where [Set Option] = 'isolation level'
DROP TABLE #Options
SET NOCOUNT OFF
GO
You could take this example and create a stored procedure. Then use ADO to call it from NAV.
But if you use ADO, it will create new connection... or not? And if yes, than you cannot use it to find transaction isol. level for current NAV session...0 -
ADO creates a new connection. And dbcc useroptions only returns the infos of the current session (and this is the ADO session). By the way. DBCC are supported in SQL 2000 / 2005, but in future version .......
Maybe you can create a stored procedure or function with an parameter like CurrSessionID and in the sql function you retrive the SET options of the "CurrSessionID". Theses sql function you call from C/AL -> ADO. But i'm not sure if there are exists some sys."Views" (maybe the sys.dm_tran_locks or you must join some others like the sys.dm_tran_XXX) in the master database which contains this infos.
RegardsDo you make it right, it works too!0 -
thank you all for your help0
-
:oops:There are no bugs - only undocumented features.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions