‎07-06-2015 03:59 PM
Select Top 1000000 tblState.Statename As [Lansweeper Asset State],
tblAssets.AssetName As [Lansweeper Assetname],
tblAssets.Domain,
Coalesce(Case When tblAssets.FQDN = '' Then Null Else tblAssets.FQDN
End, 'not scanned') As [Machine Fully Qualified Name],
tblAssets.Lastseen As [Inventory Date],
tInstallDate.InstallDate As [Install date],
Replace(tblSqlServers.serviceName, 'MSSQL$', '') As [Instance name],
'SQL Server - ' + Replace(Replace(tblSqlServers.skuName, ' (64-bit)', ''),
' Edition', '') As [Inventory Product Family Name],
Case When SubString(tblSqlServers.version, 1, 1) = '8' Then '2000'
When SubString(tblSqlServers.version, 1, 1) = '9' Then '2005'
When SubString(tblSqlServers.version, 1, 2) = '10' And
SubString(tblSqlServers.version, 4, 1) <> '5' Then '2008'
When SubString(tblSqlServers.version, 1, 2) = '10' And
SubString(tblSqlServers.version, 4, 1) = '5' Then '2008 Release 2'
When SubString(tblSqlServers.version, 1, 2) = '11' Then '2012'
When SubString(tblSqlServers.version, 1, 2) = '12' Then '2014'
Else 'Unknown' End As [Inventory Product Version Name],
'Yes' As [SQL Server Engine],
Null As [SQL Server Reporting Services],
Null As [SQL Server Analysis Services],
Null As [SQL Server Integration Services],
Null As [SQL Server - Other Components],
Null As [Installation Media Chanel],
Null As [Licensing Product Family Name],
Null As [Licensing Product Version Name],
Null As [License Quantity Required],
Null As [Active SA Quantity Required],
Null As [Active SA Assigned],
Null As [License Program Group Assigned],
Null As [License Model Assigned],
Null As [Environment Type],
Null As [SQL Database Engine Service State],
Null As [External Connector Licensing Required],
Null As [SQL Virtual Cluster Name],
Null As Division,
Null As Notes
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblSqlServers On tblAssets.AssetID = tblSqlServers.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State
Left Join (Select tblSoftware.AssetID,
Min(tblSoftware.Installdate) As InstallDate
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName Like '%sql server 20%'
Group By tblSoftware.AssetID) tInstallDate On tInstallDate.AssetID =
tblAssets.AssetID
Where tblAssets.Assettype = -1
Order By [Lansweeper Asset State],
[Lansweeper Assetname]
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now