T-SQL to get SQL server Edition, Version details

As a SQL Server DBA one of the key things is to maintain a serverlist inventory.

Below is a simple yet powerful query to have this details at hand. Further details can be included and pulled using SERVERPROPERTY()

ServerProperty('MachineName') as 'MachineName',
ISNULL((SERVERPROPERTY('InstanceName')),ServerProperty('MachineName')) as 'InstanceName',
Serverproperty('Edition') as 'Server_Edition',
Serverproperty('ProductVersion') as 'Product_Version',
serverproperty('ProductLevel') as 'Product_level'
,substring(@@version,0,(charindex('-',@@VERSION,-1))) as 'Summary'