Wednesday, March 20, 2013

SQL SERVER – Retrieve SQL Server Installation Date Time


I have been asked this question a number of times and my answer always has been “Search online and you will find the answer.” Every single time someone follows my answer, he finds the accurate answer in just a few clicks. However, this question is getting very popular nowadays, so I decided to answer this question through a blog post.

I usually prefer creating my own T-SQL script but in today’s case, I have taken the script from the Web. I have seen this script in so many places that I do not know who the original creator is, so I’m not sure who should get credit for the script.

Question: How do I retrieve SQL Server Installation date?
Answer: Run the following query and it will give you the date of SQL Server Installation.

SELECT create_date
FROM sys.server_principals
WHERE sid = 0x010100000000000512000000

Question: I have installed SQL Server Evaluation version. How do I know what is the expiry date for it?
Answer: SQL Server evaluation period lasts for 180 days. The expiration date is always 180 days from the initial installation. The following query will give the expiration date of evaluation version:

-- Evaluation Version Expire DateSELECT create_date AS InstallationDate,DATEADD(DD, 180, create_date) AS 'Expiry Date'FROM sys.server_principals
WHERE sid = 0x010100000000000512000000
GO

I believe there is a way to do this using registry, but I have not explored it personally. Now as what I’ve said earlier, there are many different blog posts on this subject. Let me list a few which I really enjoyed to read as they shared a few more insights about this subject:

Reference: Pinal Dave (http://blog.sqlauthority.com)

No comments:

Post a Comment