Question: How to Execute Query Without Using F5 or Query Toolbar in SSMS?
Answer: I had an interesting situation where I was presenting a private training for an organization and during the presentation one of the attendees asked me if I know a unique way to execute a query in SSMS. What essentially attendee was saying that generally, people run the query by either of the following ways and if I know any unique method outside of the known methods.
Here are the generic methods to execute query:
Method 1: Select the query and hit F5
Method 2: Click on the execute button in the toolbar
Method 3: Go to toolbar >> Query and select option Execute
Method 4: Highlight the query and right click over it and click on Execute
Now the question was if there was any other way to execute queries. Absolutely, I know one more method to execute a query which is generally not known much. Let us see it over here.
First, go to Options Dialog inside SQL Server Management Studio. Over here, type in following value. Please do not forget to include the greater than sign there as without that it will not work. Now just click enter and you will notice that SSMS will automatically execute the query.
Trust me, I have yet to see anyone else knowing this little trick. I do not think it makes anyone any more efficient or better. However, these tricks make me wonder how many new things which are out there and I am not aware of the same.
Reference: Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)