Manjot
Manjot

Reputation: 11516

tsql to know when sql service was installed

Using Tsql, how can I find out when MS SQL server was installed?

Upvotes: 2

Views: 145

Answers (2)

gbn
gbn

Reputation: 432180

It looks like the first 100 principal_id values are reserved in sys.server_principals (SQL Server 2005+). Based on what I see in one of my sys.server_principals (SQL Server 2005, SP3), I'd try this:

SELECT MIN(create_date) FROM sys.server_principals WHERE principal_id > 100

Upvotes: 1

Joe Stefanelli
Joe Stefanelli

Reputation: 135729

The NT AUTHORITY\SYSTEM login is created when you install SQL Server, so:

SELECT createdate 
    FROM sys.syslogins 
    WHERE name = 'NT AUTHORITY\SYSTEM'

This will return an incorrect result however if you've ever restored the Master database.

Upvotes: 2

Related Questions