SQL Server Information
Only a short script to get informations about your SQL Server enviroment, like machine name, instance name, edition, version, level, cluster security, user mode, collation and login. I use it as a piece on my whole admin scripts.
SET nocount ON;goUSE [master];goSELECT
CONVERT(CHAR(100), Serverproperty('MachineName')) AS 'MACHINE NAME',
CONVERT(CHAR(50), Serverproperty('ServerName')) AS 'SQL SERVER NAME',
(CASE WHEN CONVERT(CHAR(50), Serverproperty('InstanceName')) IS NULL
THEN 'Default Instance'
ELSE CONVERT(CHAR(50), Serverproperty('InstanceName'))
END) AS 'INSTANCE NAME',
CONVERT(CHAR(30), Serverproperty('EDITION')) AS EDITION,
CONVERT(CHAR(30), Serverproperty('ProductVersion')) AS 'PRODUCT VERSION',
CONVERT(CHAR(30), Serverproperty('ProductLevel')) AS 'PRODUCT LEVEL',
(CASE WHEN CONVERT(CHAR(30), Serverproperty('ISClustered')) = 1
THEN 'Clustered'
WHEN CONVERT(CHAR(30), Serverproperty('ISClustered')) = 0
THEN 'NOT Clustered'
ELSE 'INVALID INPUT/ERROR'
END) AS 'FAILOVER CLUSTERED',
(CASE WHEN CONVERT(CHAR(30), Serverproperty('ISIntegratedSecurityOnly')) = 1
THEN 'Integrated Security '
WHEN CONVERT(CHAR(30), Serverproperty('ISIntegratedSecurityOnly')) = 0
THEN 'SQL Server Security '
ELSE 'INVALID INPUT/ERROR'
END) AS 'SECURITY',
(CASE WHEN CONVERT(CHAR(30), Serverproperty('ISSingleUser')) = 1
THEN 'Single User'
WHEN CONVERT(CHAR(30), Serverproperty('ISSingleUser')) = 0
THEN 'Multi User'
ELSE 'INVALID INPUT/ERROR'
END) AS 'USER MODE',
CONVERT(CHAR(30), Serverproperty('COLLATION')) AS COLLATION,
Getdate() AS RunTime,
@@SPID AS 'ID',
SYSTEM_USER AS 'Login Name?',
USER AS 'User Name';go
-- END SQL Server Information --
Print article | This entry was posted by tosc on 2013-02-20 at 14:13:00 . Follow any responses to this post through RSS 2.0. |
Tag cloud
administration backup «best practices» books bug configuration ctp «cumulative update» demo dmv ebook humor index indexoptimize integrity kbfix links maintenance «ms sql server 2008» pass performance php reviews «ross mistry» serverproperty «service pack» «service pack 2» «service pack 3» «service packs» sharepoint «sql server» «sql server 2005» «sql server 2008 r2» «sql server 2012» «sql server 2014» «sql server builds» sqlcat sqlpass «sqlpass franken» ssms ssmstoolspack «stacia misner» t-sql technet «technical note» tempdb tools «trace flag» version whitepapers