Hi, MKinOZ
From your description, it looks like you've encountered an unexpected execution context switch while using ODBC to link to a SQL Server database in your application.
The issue may be related to the design of your application (it is recommended to pay attention to statements that use Windows authentication to link to the database and ensure that the connection is closed after each link).
Of course, there are many reasons that can cause execution context switches (such as SQL Server triggers, functions, etc., but since the command was successfully executed using your alternative method, it doesn't seem to be this point).
In addition, you can also monitor the process of context switching through the SQL Profiler you mentioned. Here are the suggested options:
- Audit Login
- Audit Logout
- Audit Login Failed
- ExistingConnection
- Audit Database Scope GDR Event
- Audit Schema Object GDR Event
- Audit Addlogin Event
- Audit Login GDR Event
- Audit Login Change Property Event
Best regards
Mikey Qiao