0

Is there a way for new traces to start with auto scrolling disabled?

This is the very first thing I do every time I start a trace and I'd like to optimize my workflow, especially since I run multiple traces on numerous servers, and each one starts with this option enabled (even within the same instance of Profiler).

enter image description here

I would be open to an AutoHotKey workaround. For example, I use a script that detects when a window with ID 32770 is opened to auto-type "y" (to change a file extension in Windows Explorer it falsely matches the Outlook Rule name popup window though). Also note that it can take exorbitantly long for Profiler to open, because my machine is underpowered.

P.S. To add insult to injury, if you're too fast going to the menu to disable auto scroll on your new trace, it doesn't let you...

enter image description here

  • An important use case for this: There is a particular stored procedure we have that has large pivot statements that makes Profiler lag when it shows the text data because it's much taller than the preview window, so with auto scroll enabled it basically freezes while processes are active that cause it to run, which is frequent for a particular database we have. One might consider this a true bug because it can result in profile becoming completely unresponsive, and requires force killing with Task Manager if a trace is started that doesn't first filter out giant pivot statements. – Elaskanator Mar 5 '19 at 20:56
1

Here you go my good man,

Create the following MyProfiler.vbs file in insert the following code:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "PROFILER.EXE /S <your SQL Server Name> /T Standard"
WshShell.AppActivate "PROFILER.EXE"
WScript.Sleep(5000) 
WshShell.sendkeys "%(WO)", True

Now, run MyProfiler.vbs.

Note:

It takes a few seconds to load Profiler.exe so sleep is set to 5 seconds. Otherwise, the auto-scroll commands will be input into the command window where MyProfiler is running. Cheers...

p.s.

You can run whichever template you prefer. I'm running the SQL Server Standard Template with /T.

|improve this answer|||||
  • Thanks, but there are two issues preventing this as a viable solution (I have updated my post to note them): Profiler can take a random long time to open on my underpowered computer, and I manage numerous server instances, so the ideal solution needs to respond to the application GUI elements dynamically each time I start a new trace (each trace reenables auto scroll even within the same server, grrr). – Elaskanator Jul 11 '18 at 21:26
1

I feel that this might not be the answer you are looking for, but If you are having a hard time managing multiple traces, you could switch to Extended Events or start the traces using T-SQL (sp_trace_* commands) and logging the results to a table - thus minimizing the SQL Profiler performance impact :)

|improve this answer|||||
  • Once we finally upgrade SSMS to 17.3 or newer I'm figuring out how to use the Extended Events Profiler and never looking back. That's probably the ultimate answer. – Elaskanator Aug 6 '18 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.