You could try something like
DECLARE @Table TABLE(
INSERT INTO @Table EXEC sp_who2
And filter on what you require.
- How to check if a column exists in a SQL Server table
- How do I move a table into a schema in T-SQL
- Update a table using JOIN in SQL Server?
- Using merge..output to get mapping between source.id and target.id
- Using T-SQL, return nth delimited element from a string
- When should I use semicolons in SQL Server?
- Simulation of CONNECT BY PRIOR of Oracle in SQL Server
- What is the use of GO in SQL Server Management Studio & Transact SQL?
- Fuzzy matching using T-SQL
- SQL Server Linked Server Example Query
- SQL Server: Query fast, but slow from procedure
- What is the difference between char, nchar, varchar, and nvarchar in SQL Server?
- Multiple rows to one comma-separated value in Sql Server [duplicate]
- List of all index & index columns in SQL Server DB
- SQL Server Pivot Table with multiple column aggregates
- PIVOT in sql 2005
- How to remove the time portion of a datetime value (SQL Server)?
- Confused about UPDLOCK, HOLDLOCK
- Using varchar(MAX) vs TEXT on SQL Server
- Oracle: is there a tool to trace queries, like Profiler for sql server? [closed]
- SQL Server – inner join when updating [duplicate]
- Is there a Boolean data type in Microsoft SQL Server like there is in MySQL? [duplicate]
- Add a new table column to specific ordinal position in Microsoft SQL Server
- Date conversion and culture: Difference between DATE and DATETIME
- SSRS report definition is newer than Server
- SQL Server – find nth occurrence in a string
- SQL Server: UPDATE a table by using ORDER BY
- How do I view the full content of a text or varchar(MAX) column in SQL Server 2008 Management Studio?
- How do I get date/time information from a TIMESTAMP column?
- TSQL: How to convert local time to UTC? (SQL Server 2008)
- Unique constraint on multiple columns
- SQL Server Configuration Manager cannot be found
- An attempt was made to access a socket in a way forbidden by its access permissions
- How to remove accents and all chars a..z in sql-server?
- Calendar table for Data Warehouse
- What are the differences between a clustered and a non-clustered index?
- How to migrate a PostgreSQL database into a SQLServer one?
- Why does my ODBC connection fail when running an SSIS load in Visual Studio but not when running the same package using Execute Package Utility
- How to connect to MS SQL Server using Inno Setup?
- Comparing dates stored as varchar
- Format SQL in SQL Server Management Studio
- How do I flush the PRINT buffer in TSQL?
- Programmatically retrieve SQL Server stored procedure source that is identical to the source returned by the SQL Server Management Studio gui?
- How to get the 1st value before delimiter in sql server
- Why does a parameterized query produces vastly slower query plan vs non-parameterized query
- What is the sql connection string I need to use to access localhost\SQLEXPRESS with Windows Authentication or SQL Authentication?
- How does sql server choose values in an update statement where there are multiple options?
- T-SQL incrementing counter based on change in a column value
- Avg of float inconsistency
- How to generate auto increment field in select query