How to check when was SQL Server installed with a T-SQL query
Today on twitter Lori Edwards (@loriedwards) asked how can you check when was SQL Server installed with a T-SQL query. Otherwise this is pretty simple by looking at the creation time of master database (provided you never had to restore it).
But i wanted to find a nice way of doing this without resorting to any xp_ stored procedures. Of course this is possible by looking into the sys.syslogins compatibility view:
SELECT createdate as Sql_Server_Install_Date
FROM sys.syslogins
where sid = 0x010100000000000512000000 -- language neutral
-- loginname = 'NT AUTHORITY\SYSTEM' -- only English language installations
This query actually returns the creation date and time of the NT AUTHORITY\SYSTEM login which gets created when you install SQL Server. This of course won’t work if you had to restore the master database.
Pretty simple if you know where to look :))