The following query shows report history for a report name (Employee Attendance Report) in the WHERE clause. This is a great way to check what […]
Rename Database By closing connections
When trying to rename database with open database connections its always a pain as the admin has to kill those connections. Instead of going that […]
How to read registry entries for SQL?
Following query shows all the registry values on the server. select[registry_key],[value_name],[value_data]from [sys].[dm_server_registry]
How to get SQL Service details?
Run the following query under context of any system or user database to get the sql server database engine account and the account for sql […]
How to tell when data changed in a table?
This query will show list of each table when it was last scanned SELECTOBJECT_NAME(OBJECT_ID) AS TableName,[database_id],[object_id],[index_id],[user_seeks],[user_scans],[user_lookups],[user_updates],[last_user_seek],[last_user_scan],[last_user_lookup],[last_user_update],[system_seeks],[system_scans],[system_lookups],[system_updates],[last_system_seek],[last_system_scan],[last_system_lookup],[last_system_update]FROM sys.dm_db_index_usage_statsWHERE database_id = DB_ID( ‘NameOfDatabase’) Note: Replace the ‘NameOfDatabase‘ […]