SQL Tips by Namwar Rizvi

June 17, 2007

Execute stored procedure without using exec statement

Filed under: Information,New Features,Query,Shortcuts,SQL Server 2005,tips,TSQL — namwar @ 11:01 PM

There are lots of shortcuts in SQL Server Management Studio and I found one yesterday. May be most of you are already aware of this but I just want to share it.

If you want to execute a stored procedure and assuming it does not require any parameter or all parameters have default values assigned then instead of typing exec before the stored procedure name, you can just select it and press Ctrl+E or F5 and that is it!

For example, we have a following stored procedure:

Create Proc GetServerDateTime
as
Begin

Select GetDate()
End

Just highlight the name of stored procedure which is GetServerDateTime and press F5. SMS will execute it for you without asking you to type exec statement.

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: