Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ctrl - K on T-SQL 1

Status
Not open for further replies.

RovirozM

Technical User
Dec 9, 2009
37
MX
Hi Guys,

Just curious, in some Web sites mention to use the Control K and then run some queries...

What is the use of this HotKey? when I'm trying on the SQL New Query Windows it put me a message "Waiting for a second Key", also if I pressed twice it put a little box on the left of my code where I'm in...

It is a dummy question, but I'm interesting in know (Maybe is something that will help me later)...

I also thought this little box was a Step Point...

Thanks!

MR
 
SQL 2000 shipped with Query Analyzer. This tool was similar to the query window you see in SQL Server Management Studio. Basically, you can write code and execute it.

SQL 2005 & SQL 2008 replaced Enterprise Manager and Query Analyzer with the new SQL Server Management Studio, which is a combination of the 2 older tools.

In Query Analyzer, you can press CTRL-K and then run a query and you will see a graphical display of the execution plan. This hotkey combination was replaced with CTRL-M in SQL Server Management Studio. So, whenever you see a web site article (that is talking about sql 2000), and mentions CTRL-K, you need to use CTRL-M instead.

For example....

Open a query window.
Load a query.
Press CTRL-M (it will appear as though nothing happened)
Press F5 (to run the query).

You will see a new tab labeled "Execution Plan". This tab will show a graphical representation of how SQL Server executes your query. In this tab, you will see relative "costs" for various parts of the execution plan. You may see things like sort, table scan, index scan, index seek, clustered index seek, etc...

Learning how to interpret the results of the execution plan is too big a topic for this post. But, suffice to say, it is an important evolutionary development in your SQL coding skills. For this, I would recommend google, something like [google]understanding SQL Server execution plans[/google]. Read the first couple articles. See how it applies to your queries, and attempt to make your queries better.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks to both Guys!!!

gmmastros Excellent Explanation!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top