Select @@SERVERNAME -- Server and instance name
Select @@VERSION -- SQL Server Version
Select @@ServiceName -- SQL Server Instance
Select DB_NAME() -- Current Database
SELECT * FROM sys.servers ORDER BY name --Linked Servers
--Last Databases Backup:
SELECT @@Servername AS ServerName ,
d.Name AS DBName ,
MAX(b.backup_finish_date) AS LastBackupCompleted
FROM sys.databases d
LEFT OUTER JOIN msdb..backupset b
ON b.database_name = d.name AND b.[type] = 'D'
GROUP BY d.Name
ORDER BY d.Name;
And more - in the article "Exploring Your SQL Server Databases with T-SQL":
No comments:
Post a Comment