-- this works starting 2008 onwards with cte as ( select (select min(last_user_dt) from (values (last_user_update),(last_user_seek),(last_user_scan),(last_user_lookup)) as all_val(last_user_dt)) as dt ,DB_NAME(database_id) as dbName from sys.dm_db_index_usage_stats ) select min(dt) as since from cte where dbName = 'NORTHWIND' -- to check when was the database accessed last time. use the below. source : https://www.mssqltips.com/sqlservertip/3171/identify-sql-server-databases-that-are-no-longer-in-use/ |
Thursday, December 20, 2012
sql server when was the database table accessed last time
Subscribe to:
Post Comments (Atom)
Featured Post
SQL Server AWS Migration BCP
stored procedure to generate BCP scritps to migrate the SQL Server database. Developed this stored procedure on my labs to simulate t...
-
query execution in the production taking long time one of the query in the production taking almost 40 minutes instead seconds where it us...
-
SQL Server Data Masking : Download code DataMasking.sql Masking data can be done through updating the confidential information in t...
-
Pivot without Aggregating with consistent and inconsistent formats: One of the most common tasks which I came across at least once in almo...
No comments:
Post a Comment