November 16, 2022 at 12:56 pm
We have an established ASP.NET application and SQL Server database in production, and have observed a "status" (integer ID value) in a particular user table changing value, then reverting back, before changing to the original value again, all within a few milliseconds.
There are triggers on the table, and a good amount of code around this area. But there is no obvious culprit.
What I am trying to establish is, "what is causing the status to oscillate in this way?", as looking at the code it shouldn't be doing so.
We have considered writing @@NESTLEVEL to a table in particular objects, but this doesn't really give us insight as to what is causing the oscillation in status.
How else might we best fault-find this?
November 16, 2022 at 7:18 pm
Cascading triggers?
--Jeff Moden
Change is inevitable... Change for the better is not.
November 18, 2022 at 10:40 am
Could well be...
I have created an Extended Event session to try to capture what's going on.
-- Create new Extended Event session.
CREATE EVENT SESSION [StatusChanges] ON SERVER
ADD EVENT sqlserver.sp_statement_completed
(
SET collect_object_name = (1), collect_statement = (1)
ACTION (sqlserver.database_name, sqlserver.server_principal_name, sqlserver.sql_text)
WHERE
(
[sqlserver].[equal_i_sql_unicode_string] ([sqlserver].[database_name], N'MyDatabase') AND
[sqlserver].[like_i_sql_unicode_string] ([statement], N'%UPDATE%P%SET%Status%=%')
)
)
ADD TARGET package0.event_file (SET filename = N'C:\Temp\StatusChanges.xel', max_file_size=(100))
WITH
(
MAX_MEMORY = 4096 KB,
EVENT_RETENTION_MODE = ALLOW_SINGLE_EVENT_LOSS,
MAX_DISPATCH_LATENCY = 30 SECONDS,
MAX_EVENT_SIZE = 0 KB,
MEMORY_PARTITION_MODE = NONE,
TRACK_CAUSALITY = ON,
STARTUP_STATE = ON
);
GO
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply