Skip to content

Dirceu Resende

DBA SQL Server and BI Analyst (PowerBI, SSAS, SSIS, SSRS)

  • Consultancy
    • BI Consulting
    • Power BI Consulting
    • SQL Server Consulting
  • File
  • Series
    • Certification
    • Security and Audit
    • Performance tuning
    • What has changed in T-SQL?
    • Data Protection
  • Jobs
  • Data Platform Events
  • About
  • Contact

Other Languages

Subscribe to a blog by email

Enter your email address to subscribe to this blog and receive notifications of new publications by email.

Join 536 other subscribers

Blog Views

1.645.448 views

Categories

  • Apache / .htaccess (9)
  • Database (307)
    • MySQL / MariaDB (4)
    • Oracle (8)
    • SQL Server (293)
      • Audit (15)
      • Azure (2)
      • CLR (53)
      • Query Development (83)
      • DMVs and Catalog Views (31)
      • Errors (22)
      • Tools (12)
      • Data Formatting and Validation (23)
      • Little Known Features (19)
      • Hacks (17)
      • Easy (30)
      • File Handling (13)
      • Maintenance (80)
      • Monitoring (35)
      • What not to do (7)
      • OLE Automation (19)
      • Performance tuning (22)
      • Python (1)
      • Safety (39)
      • SQL Server Agent (11)
  • Business Intelligence (BI) (31)
    • Analysis Services (SSAS) (7)
    • Microsoft (7)
    • Power BI (12)
    • Reporting Services (SSRS) (8)
  • Career and Courses (13)
  • Career, Courses and Certifications (28)
  • Cell Phones (1)
  • Events and Lectures (63)
  • Programme (57)
    • C # (CSharp) (30)
    • CSS (1)
    • ERP (1)
    • javascript (1)
    • PHP (17)
    • Powershell / CMD (8)
    • SQLCLR (4)
  • Uncategorized (10)
  • SEO (4)
  • Virtualization (5)

Microsoft MVP Data Platform

My Certifications

Training

Posts Archive

Recent Posts

  • Black Friday discounts on SQL Server Trainings (Buy my kkkkk course) November 27th, 2020
  • SQL Server - The “new” GREATEST and LEAST functions November 27th, 2020
  • SQL Server - How to know the date of a user's last login November 9th, 2020
  • Azure in Free Practice # 07 - Administering Databases in Azure November 5th, 2020
  • Analysis Services - An error occurred while opening the model on the workspace database. Reason: An unexpected error occurred (file 'tmcachemanager.cpp', function 'TMCacheManager :: CreateEmptyCollectionsForAllParents') November 5th, 2020
  • 29 January 2017
  • 2
  • Database DMVs and Catalog Views Monitoring SQL Server

SQL Server - How to find out when the instance was installed (date of installation)

Views: 1.701
Reading Time: 2 minutes

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.

Transact-SQL
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

Results of consultations:

If you want to know when your trial version of SQL Server will expire, simply run the query below:

Transact-SQL
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

Query Result:

That's it folks!
Regards and see you next post.

tags: sqlsql server

You may also like ...

  • SQL Server - How to find out how long the instance has been online or when the instance was started

  • [Video] - Introduction to SQLCLR

  • How to convert numbers to roman numerals in SQL Server

  • Next SQL Server - How to send emails through the database using CLR (C #)
  • Previous SQL Server - How to Email a Query Result in HTML Format Using CLR (C #)

Comments

  • Comments2
  • Pingbacks0
  1. MARCO PAULO VASCONCELOS said:
    15 June 2018 to 13: 20

    and when you can no longer enter the application

    Reply
    • Dirceu Resende said:
      15 June 2018 to 13: 42

      Hey Marcos. All right? I didn't understand, could you explain?

      Reply

Leave a Comment Cancel reply

Dirceu Resende © 2020. All Rights Reserved.