With the below T-SQL script, you can get basic SQL Server instance info such as:
Full instance name
SQL Server version
Edition
Collation
Number of databases
Product level (i.e. SP-level)
…and more
The T-SQL Script
The script uses the built-in SQL Server function SERVERPROPERTY.
SELECT
SERVERPROPERTY('ServerName') AS FullInstanceName,
REPLACE(SUBSTRING(@@version,0,CHARINDEX('-',@@version)),'Microsoft ','') as FullSQLVersion,
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('ProductLevel') AS ProductLevel,
SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS ComputerNamePhysicalNetBIOS,
SERVERPROPERTY('MachineName') AS MachineName,
SERVERPROPERTY('InstanceName') as InstanceName,
SERVERPROPERTY('BuildClrVersion') AS BuildClrVersion,
SERVERPROPERTY('Collation') AS Collation,
SERVERPROPERTY ('edition') as InstanceEdition,
CASE WHEN SERVERPROPERTY('EngineEdition')=1 THEN 'Personal/Desktop'
WHEN SERVERPROPERTY('EngineEdition')=2 THEN 'Standard'
WHEN SERVERPROPERTY('EngineEdition')=3 THEN 'Enterprise'
WHEN SERVERPROPERTY('EngineEdition')=4 THEN 'Express'
WHEN SERVERPROPERTY('EngineEdition')=5 THEN 'SQL Database'
WHEN SERVERPROPERTY('EngineEdition')=6 THEN 'SQL Data Warehouse'
END AS EngineEdition,
CASE WHEN SERVERPROPERTY('IsClustered')=1 THEN 'Clustered'
WHEN SERVERPROPERTY('IsClustered')=0 THEN 'Not Clustered'
ELSE 'N/A' END AS ClusteredStatus,
(SELECT COUNT(*) FROM sys.databases) AS TotalDatabases
Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!
(Lifetime Access/ Live Demos / Downloadable Resources and more!)
Sharpen your SQL Server database programming skills via a large set of tips on T-SQL and database development techniques. The course, among other, features over than 30 live demonstrations!
(Lifetime Access, Certificate of Completion, downloadable resources and more!)
Artemakis Artemiou is a Senior SQL Server Architect, Author, a 9 Times Microsoft Data Platform MVP (2009-2018) and a Udemy Instructor. He has over 15 years of experience in the IT industry in various roles. Artemakis is the founder of SQLNetHub and TechHowTos.com. Artemakis is the creator of the well-known software tools Snippets Generator and DBA Security Advisor. Also, he is the author of many eBooks on SQL Server. Artemakis currently serves as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA). Moreover, Artemakis teaches on Udemy, you can check his courses here.
Views: 1,463
Online Course Offer | “SQL Server Fundamentals – SQL Database for Beginners“
SQL Server Database training for beginners, that covers SQL Server on both Windows and Linux.
Best practice recommendations are also included in live demonstrations.
This site uses cookies for personalized content and the best possible experience. By continuing to browse this site, you agree to this use. Find out more.