TSQL: Get Last Queries Ran

前端 未结 4 1671
傲寒
傲寒 2020-12-07 10:05

Is there a way to get the SQL text for the last few queries?

I am using Microsoft SQL Server 2005

4条回答
  •  抹茶落季
    2020-12-07 10:22

    The only way I'm aware of is to have the SQL Server Profiler running. Unfortunately this needs to be started prior to the queries being executed, so if you're hoping to catch something that's happened on an "ad hoc" basis, it won't be suitable. If you're trying to track what a piece of code's doing and want to capture the queries it executes, it should work a treat.

提交回复
热议问题