#SQLSERVERLearning : Only Execute Current Statement in SQL Server Mgmt Studio??

All my blogs with #SQLSERVERLearning is intended to cover all stuff identified as difference between Oracle and SQL Server.
Hopefully it might be helpful for Oracle guy also working in SQL Server world.

For complete list of topics on SQL Server, please check Menu – SQL Server Learning.

After setting CTRL-ENTER as shortcut for running a SQL statement was feeling kinda cool, now can run query in my usual way!
For exploring how to change shortcut for query executions please check here

But wait SQL Server had some new problem area to get unfold and frankly speaking really annoying for any Oracle Guy!
Whenever we run a single statement without selecting statement, we end up running entire statement in Query Editor!

YES Entire statement!, Not sure why the need for same.

blog1

Thought let google the answer, But no forum or blog were able to provide Simple-Single-Shortcut to Execute Current Highlighted statement.
SQL Developer Allows that and it make sense, why any one would want to run and each and every statement with in a query editor as Day to Day normal Executions.
Its should be up to us on what we need to execute, Current statement or set of statement without Selecting SQL text every-time for executions.

Found some Add On, Plug in but everyone don’t have leverage to install external software.

If some one have any better way to execute current statement, will be keen to get help.

Currently using below methods to run individual SQL statement.

IF ( SQL statement Text is with in single line )
Then
1. SHIFT – Upper Arrow
Select Text to run
2. Then use already Set Shortcut to Run SQL Statement, CTRL- ENTER.

ELSE
Thought lets try to use Collapse and Expand options to run SQL having text across multiple lines or formatted queries.

Using Keyboard Shortcuts, had set new Shortcut for Collapse and Expand options in SQL Server Query Editor.

blog2

blog3

For Execution now need to follow following options.

1. Collapse SQL Text using ALT-C
2. Repeat Steps Mention in above IF Clause.

End If;

I know these all problems are non technical,but having ease on analysis and running SQL efficiently equally matter.

About Deepak Mahto

Having 8+ Years of relevant/exciting/fruitful/challenging/learning in Oracle Technology. Currently working as Oracle Performance Consultant in an MNC. Hold Expertise in Performance Engineering, SQL Tuning, Database Tuning, SQL, PLSQL Development/Design Considerations and Oracle Internals. I enjoy reading on Oracle internals, posting some of my finding or observations and playing football.
This entry was posted in SQL Server Learning and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s