When was my SQL Server Installed?

I was going through the SQL Server Security Catalog view and stumbled upon the sys.server_principals view. This view contains a row for every server-level principal. When you install SQL Server 2005/2008, the NT AUTHORITY\SYSTEM login gets created. Querying this view, we can easily retrieve the creation date. Here’s how:

SQL Server 2005/2008

SELECT create_date
FROM sys.server_principals

SQL Server 2000

SELECT createdate
FROM sys.syslogins



If you know of a simpler way to retrieve the SQL Server installation date, make sure to drop a comment.

Note: This query will not give correct results, if in between your master database became corrupt and you had to rebuild it. I will update this post with other such exceptions(as and when I learn about them) when this query may not return expected results.

About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

No comments: