I've been using the Query Analyzer that comes with Microsoft SQL Server 2000 since it was first released and just discovered this trick today.
TIP: Query Analyzer - Selective Query ResultsIf you ever wish to run just a subset or portion of a query, highlight the portion of your query you want results for and click the "Execute Query" button (or hitting [F5].) Query Analyzer will then run just the portion of SQL code that's selected and display the results in the Results Grid.
This works great if you want to see what a query is doing without the where clause, or perhaps to see the results of an inner select statement. In the past I was always copying these to a new window to run. No more!
I can't believe I've never noticed this before. This is why occasionally I've gotten weird SQL errors that have been fixed by clicking somewhere in the SQL query window.
Comments for this entry have been disabled.