HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

What is the best way to filter or otherwise manipulate the results returned by a stored procedure?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storedreturnedthewhatmanipulatewayprocedurefilterresultsotherwise

Problem

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?

Solution

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

Context

StackExchange Database Administrators Q#918, answer score: 7

Revisions (0)

No revisions yet.