Home All Groups Group Topic Archive Search About

Show Execution Plan by Default?

Author
8 Jul 2005 6:19 PM
Mike Labosh
I've entered a phase on this project where everything is about performance.

I have spent several days now in QA looking at query plans, index statistics
and so forth.

It would be cool if there were a way for me to booger QA into always having
the "Show Execution Plan" always turned on.  Or am I just out of luck?

--
Peace & happy computing,

Mike Labosh, MCSD
"Working here is like living inside a Salvador Dali painting." -- Me.  Yeah,
ME!  [Oh fer cryin out loud]

Author
8 Jul 2005 6:54 PM
Aaron Bertrand [SQL Server MVP]
Create a template file with the following at the top:

SET STATISTICS IO ON
SET STATISTICS TIME ON
SET STATISTICS PROFILE ON

A



Show quote
"Mike Labosh" <mlab***@hotmail.com> wrote in message
news:OB8eam%23gFHA.3544@TK2MSFTNGP15.phx.gbl...
> I've entered a phase on this project where everything is about
> performance.
>
> I have spent several days now in QA looking at query plans, index
> statistics and so forth.
>
> It would be cool if there were a way for me to booger QA into always
> having the "Show Execution Plan" always turned on.  Or am I just out of
> luck?
>
> --
> Peace & happy computing,
>
> Mike Labosh, MCSD
> "Working here is like living inside a Salvador Dali painting." -- Me.
> Yeah, ME!  [Oh fer cryin out loud]
>
Author
8 Jul 2005 7:38 PM
Mike Labosh
> SET STATISTICS IO ON
> SET STATISTICS TIME ON
> SET STATISTICS PROFILE ON

Ack no!  I want the graphical pretty query plan not the text-based one.
--
Peace & happy computing,

Mike Labosh, MCSD
"Working here is like living inside a Salvador Dali painting." -- Me.  Yeah,
ME!  [Oh fer cryin out loud]
Author
9 Jul 2005 9:44 AM
oj
There isn't an option. But nothing is stopping you from writing a quick vbs
to wShell.Run("isqlw -S<server> -U<user> -P<pwd>") then wShell.Sendkeys "^K"


--
-oj


Show quote
"Mike Labosh" <mlab***@hotmail.com> wrote in message
news:%23kasUS$gFHA.3164@TK2MSFTNGP15.phx.gbl...
>> SET STATISTICS IO ON
>> SET STATISTICS TIME ON
>> SET STATISTICS PROFILE ON
>
> Ack no!  I want the graphical pretty query plan not the text-based one.
> --
> Peace & happy computing,
>
> Mike Labosh, MCSD
> "Working here is like living inside a Salvador Dali painting." -- Me.
> Yeah, ME!  [Oh fer cryin out loud]
>
Author
9 Jul 2005 7:45 PM
Steve Beach
Were you able to get this to work?  I thought I'd give it a try for
grins.  But I can't seem to send any CTRL characters through WScript.

Here is my test script.  Watch for wrapping.

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run("""C:\Program Files\Microsoft SQL
Server\80\Tools\Binn\isqlw"" -Slocalhost -E")
objShell.AppActivate "SQL Query Analyzer"
Wscript.Sleep 1000
objShell.Sendkeys "select count{(}*{)} from syscomments~"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL K~"
Wscript.Sleep 100
objShell.Sendkeys "^K"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL L~"
Wscript.Sleep 100
objShell.Sendkeys "^L"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL E~"
Wscript.Sleep 100
objShell.Sendkeys "^E"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending F5~"
Wscript.Sleep 100
objShell.Sendkeys "{F5}"

Set objShell = nothing
WScript.Quit




oj said the following on 7/9/2005 2:44 AM:
Show quote
> There isn't an option. But nothing is stopping you from writing a quick vbs
> to wShell.Run("isqlw -S<server> -U<user> -P<pwd>") then wShell.Sendkeys "^K"
>
>
Author
9 Jul 2005 9:29 PM
oj
It works just fine. Try this.

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run("isqlw -Slocalhost -E")
objShell.AppActivate "SQL Query Analyzer"
Wscript.Sleep 1000
objShell.Sendkeys "select count{(}*{)} from syscomments~"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL K~"
Wscript.Sleep 1000
objShell.Sendkeys "^(k)"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL L~"
Wscript.Sleep 1000
objShell.Sendkeys "^(l)"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending CTRL E~"
Wscript.Sleep 1000
objShell.Sendkeys "^(e)"
Wscript.Sleep 500
objShell.Sendkeys "-- Sending F5~"
Wscript.Sleep 1000
objShell.Sendkeys "{F5}"

Set objShell = nothing
WScript.Quit

--
-oj



Show quote
"Steve Beach" <ohbil***@GGGGGGGGGGGGGGGGmail.com> wrote in message
news:unSaS7LhFHA.3936@tk2msftngp13.phx.gbl...
> Were you able to get this to work?  I thought I'd give it a try for
> grins.  But I can't seem to send any CTRL characters through WScript.
>
> Here is my test script.  Watch for wrapping.
>
> Option Explicit
> Dim objShell
> Set objShell = CreateObject("WScript.Shell")
> objShell.Run("""C:\Program Files\Microsoft SQL
> Server\80\Tools\Binn\isqlw"" -Slocalhost -E")
> objShell.AppActivate "SQL Query Analyzer"
> Wscript.Sleep 1000
> objShell.Sendkeys "select count{(}*{)} from syscomments~"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL K~"
> Wscript.Sleep 100
> objShell.Sendkeys "^K"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL L~"
> Wscript.Sleep 100
> objShell.Sendkeys "^L"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL E~"
> Wscript.Sleep 100
> objShell.Sendkeys "^E"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending F5~"
> Wscript.Sleep 100
> objShell.Sendkeys "{F5}"
>
> Set objShell = nothing
> WScript.Quit
>
>
>
>
> oj said the following on 7/9/2005 2:44 AM:
>> There isn't an option. But nothing is stopping you from writing a quick
>> vbs
>> to wShell.Run("isqlw -S<server> -U<user> -P<pwd>") then wShell.Sendkeys
>> "^K"
>>
>>
Author
10 Jul 2005 9:27 AM
Steve Beach
Funky.  The reason why my original script didn't work is because of the
capital letters.  Just changing ^K to ^k and ^L to ^l and ^E to ^e made
it work.

I tried manually hitting CTRL-L in QA (with caps lock on) and it worked.
But hitting CRTL-SHIFT-L in QA did not work.  I wonder if sendkeys is
sending a CTRL-SHIFT-L when ^L is specified.  A shift shouldn't be sent
unless a "+" is specified.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp

Anyway, thanks for the correction on the script. Perhaps the OP will
make use of it.


oj said the following on 7/9/2005 2:29 PM:
Show quote
> It works just fine. Try this.
>
> Option Explicit
> Dim objShell
> Set objShell = CreateObject("WScript.Shell")
> objShell.Run("isqlw -Slocalhost -E")
> objShell.AppActivate "SQL Query Analyzer"
> Wscript.Sleep 1000
> objShell.Sendkeys "select count{(}*{)} from syscomments~"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL K~"
> Wscript.Sleep 1000
> objShell.Sendkeys "^(k)"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL L~"
> Wscript.Sleep 1000
> objShell.Sendkeys "^(l)"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending CTRL E~"
> Wscript.Sleep 1000
> objShell.Sendkeys "^(e)"
> Wscript.Sleep 500
> objShell.Sendkeys "-- Sending F5~"
> Wscript.Sleep 1000
> objShell.Sendkeys "{F5}"
>
> Set objShell = nothing
> WScript.Quit
>
Author
12 Jul 2005 12:20 AM
oj
Yup. Sendkeys sends literals. So, "^L" is equivalent to CTRL-SHIFT-L. ;-)

--
-oj


Show quote
"Steve Beach" <ohbil***@GGGGGGGGGGGGGGGGmail.com> wrote in message
news:uvY%23ZGThFHA.3936@TK2MSFTNGP10.phx.gbl...
> Funky.  The reason why my original script didn't work is because of the
> capital letters.  Just changing ^K to ^k and ^L to ^l and ^E to ^e made
> it work.
>
> I tried manually hitting CTRL-L in QA (with caps lock on) and it worked.
> But hitting CRTL-SHIFT-L in QA did not work.  I wonder if sendkeys is
> sending a CTRL-SHIFT-L when ^L is specified.  A shift shouldn't be sent
> unless a "+" is specified.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp
>
> Anyway, thanks for the correction on the script. Perhaps the OP will
> make use of it.
>
>
> oj said the following on 7/9/2005 2:29 PM:
>> It works just fine. Try this.
>>
>> Option Explicit
>> Dim objShell
>> Set objShell = CreateObject("WScript.Shell")
>> objShell.Run("isqlw -Slocalhost -E")
>> objShell.AppActivate "SQL Query Analyzer"
>> Wscript.Sleep 1000
>> objShell.Sendkeys "select count{(}*{)} from syscomments~"
>> Wscript.Sleep 500
>> objShell.Sendkeys "-- Sending CTRL K~"
>> Wscript.Sleep 1000
>> objShell.Sendkeys "^(k)"
>> Wscript.Sleep 500
>> objShell.Sendkeys "-- Sending CTRL L~"
>> Wscript.Sleep 1000
>> objShell.Sendkeys "^(l)"
>> Wscript.Sleep 500
>> objShell.Sendkeys "-- Sending CTRL E~"
>> Wscript.Sleep 1000
>> objShell.Sendkeys "^(e)"
>> Wscript.Sleep 500
>> objShell.Sendkeys "-- Sending F5~"
>> Wscript.Sleep 1000
>> objShell.Sendkeys "{F5}"
>>
>> Set objShell = nothing
>> WScript.Quit
>>

AddThis Social Bookmark Button