Tuesday, October 1, 2024

.::: Check Date when Microsoft SQL Server (MSSQL), MariaDB MySQL & PostgreSQL Installed & Upgraded :::.


1. MSSQL
 
SELECT @@servername as ServerName,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 'SQLInstallDate'
      ,(select modify_date from sys.server_principals where name like '%##MS_SQLAuthenticatorCertificate##%') as SQLUpgradeDate
FROM sys.server_principals
WHERE name='NT AUTHORITY\SYSTEM';

 


2. MariaDB MySQL
 
SELECT @@hostname,@@version,MIN(CREATE_TIME) AS install,Min(UPDATE_TIME)  AS upgrade
FROM information_schema.tables
WHERE table_schema LIKE '%mysql%';

 

3. PostgreSQL & EDB
 
SELECT datname AS "Database",
       pg_catalog.pg_encoding_to_char(encoding) AS "Encoding",
       datcollate AS "Collation",
       datctype AS "Character Type",
       (pg_stat_file('base/' || oid || '/PG_VERSION')).modification AS "Installation Date",
       (SELECT creation AS Upgrade_Date FROM pg_stat_file(current_setting('data_directory') || '/base/16397')) as UpgradeDate, VERSION()
FROM pg_database
WHERE datname = 'template1';
 


No comments:

Post a Comment

Popular Posts