Skip to main content

6 docs tagged with "Microsoft SQL Server"

View All Tags

Activities on SQL server

This SQL script creates a temporary table named @Table and populates it with the results of the system stored procedure sp_who2, which returns information about active connections to a SQL Server instance. The SELECT statement then retrieves all rows from @Table where the DBName column matches any value, effectively returning information about all active connections regardless of the database they are connected to.

Find Restore History

This SQL script fetches information about database restores from a table called restorehistory in the msdb database.