Flushes the last 100 Microsoft® SQL Server™ SQL and exception events into the specified file name.
xp_trace_flushqueryhistory 'filename'
0 (success) or >1 (failure)
When filename is valid, xp_trace_flushqueryhistory returns this message.
The command(s) completed successfully.
When used following xp_trace_setqueryhistory, SQL Server Profiler can open the specified file name to view the last 100 SQL Server SQL and exception events.
Execute permissions for xp_trace_flushqueryhistory default to members of the sysadmin fixed server role but can be granted to other users.
Monitoring with SQL Server Profiler | System Stored Procedures (SQL Server Profiler Extended Procedures) |
xp_trace_setqueryhistory |