SQL Server - Query logs?
any idea where I can read logs of recent queries?
Errors are coming back when using Django for queries that seem to be alright, and cannot understand what is wro开发者_如何学Pythonng.
Any ideas?
As I understanded you need MS SQL Profiler. But it log only new queries.
There are no logs of recent queries. You can use SQL Profiler / SQL Trace to monitor queries ongoing though.
You can also look in sys.dm_exec_cached_plans
for recent plans and associated text which might help depending on whether the error was a parse/compilation error or not.
select text from
sys.dm_exec_cached_plans
cross apply sys.dm_exec_sql_text(plan_handle)
If you are using SQL Server 2005 and above, you can track the DDL queries using the Default Trace.
精彩评论