Views: 3.036 views
Hello people,
Good afternoon!
In this post I will show you how to find out when the SQL Server instance was installed (date of installation), information that is very useful for system inventory or to let you know when the trial version you have installed will expire.
There are several ways to identify the date of installation of SQL Server, but I will demonstrate only the best known.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
-- Utilizando a server_principals SELECT create_date AS 'SQL Server Installation Date' FROM sys.server_principals WHERE sid = 0x010100000000000512000000 -- NT AUTHORITY\SYSTEM -- Utilizando a syslogins SELECT createdate as 'SQL Server Installation Date' FROM sys.syslogins WHERE sid = 0x010100000000000512000000 -- NT AUTHORITY\SYSTEM -- Obtendo mais informações da instalação SELECT SERVERPROPERTY('productversion') AS ProductVersion, SERVERPROPERTY('productlevel') AS ProductLevel, SERVERPROPERTY('edition') AS Edition, SERVERPROPERTY('MachineName') AS MachineName, SERVERPROPERTY('LicenseType') AS LicenseType, SERVERPROPERTY('NumLicenses') AS NumLicenses, create_date AS 'SQL Server Installation Date' FROM sys.server_principals WHERE sid = 0x010100000000000512000000; -- NT AUTHORITY\SYSTEM |
If you want to know when your trial version of SQL Server will expire, simply run the query below:
1 2 3 4 5 6 7 8 9 10 11 |
-- Verificando a data de expiração do SQL Server (180 dias após instalação) SELECT @@SERVERNAME AS Server_Name, create_date as 'SQL Server Installation Date', DATEADD(DAY, 180, create_date) as 'SQL Server Expiration Date', DATEDIFF(DAY, create_date, GETDATE()) AS Days_Used, DATEDIFF(DAY, GETDATE(), DATEADD(DAY, 180, create_date)) AS Days_Left FROM sys.server_principals WHERE sid = 0x010100000000000512000000 -- NT AUTHORITY\SYSTEM |
That's it folks!
Regards and see you next post.
and when you can no longer enter the application
Hey Marcos. All right? I didn't understand, could you explain?