Often I find myself wanting to filter or order the results returned by
execing a stored procedure - for example to order the output of
sp_who2 by login or CPU Time, or filter it by host name. What is the best way to achieve this?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
One possible solution is to put the result set into a temp table and select from it. Here is an example for sp_who2: SQL Server: Filter output of sp_who2
I love the SMSToolpack. its a free download and lets you sort the resulting grid of any sql query you run.
On top of that, you can search the data just like searching for a text string in excel.
it helps format you SQL text and makes it look pretty so you can be proud of your SQL code and much more...
The best thing i think is it lets you color code windows to specific servers so its simple to know when you are running code on dev vs prod