‎06-09-2015 04:43 PM
Solved! Go to Solution.
‎06-10-2015 03:16 PM
Select Top 1000000 tblState.Statename As [Lansweeper Asset State],
tblAssets.AssetName,
tblAssets.AssetID,
tblAssets.Domain,
tblAssets.FQDN As [Machine Fully Qualified Name],
tblAssets.Lastseen As [Inventory Date],
tblOperatingsystem.Caption As OS,
tblSqlServers.serviceName As [SQL service name],
tSQLSoftware.softwareName As [SQL Version],
tblSqlServers.skuName As [SQL edition],
tblOperatingsystem.InstallDate As [Install date (OS)],
tSQLSoftware.Lastchanged As [Last software change date],
CPUCount.[Count physical CPUs],
CPUCount.[Count CPU cores],
CPUCount.[Count logical CPUs]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblAssetCustom.State = tblState.State
Left Join tblSqlServers On tblSqlServers.AssetID = tblAssets.AssetID
Inner Join (Select Top 1000000 tSQLSoftware.AssetID,
tSQLSoftware.softwareName,
tSQLSoftware.softwareVersion,
tSQLSoftware.Lastchanged,
tSQLSoftware.Installdate
From (Select Max(Case
When CharIndex('(', tblSoftwareUni.softwareName) >
0 Then SubString(tblSoftwareUni.softwareName, 1, CharIndex('(',
tblSoftwareUni.softwareName) - 1) Else tblSoftwareUni.softwareName
End) As softwarename,
tblSoftware.AssetID
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName In ('Microsoft SQL Server 2000',
'Microsoft SQL Server 2005', 'Microsoft SQL Server 2008',
'Microsoft SQL Server 2008 R2', 'Microsoft SQL Server 2008 (64-bit)',
'Microsoft SQL Server 2008 R2 (64-bit)', 'Microsoft SQL Server 2012',
'Microsoft SQL Server 2014', 'Microsoft SQL Server 2012 (64-bit)',
'Microsoft SQL Server 2014 (64-bit)')
Group By tblSoftware.AssetID) tSQLHighest
Inner Join (Select tblSoftware.Lastchanged,
tblSoftware.Installdate,
tblSoftware.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID)
tSQLSoftware On tSQLHighest.AssetID = tSQLSoftware.AssetID And
Replace(tSQLHighest.softwarename, ' ', '*') = Replace(Case
When CharIndex('(', tSQLSoftware.softwareName) >
0 Then SubString(tSQLSoftware.softwareName, 1, CharIndex('(',
tSQLSoftware.softwareName) - 1) Else tSQLSoftware.softwareName
End, ' ', '*')) tSQLSoftware On tSQLSoftware.AssetID = tblAssets.AssetID
Left Join tblOperatingsystem On tblOperatingsystem.AssetID = tblAssets.AssetID
Left Join (Select tblProcessor.AssetID,
Sum(tblProcessor.NumberOfLogicalProcessors) As [Count logical CPUs],
Sum(tblProcessor.NumberOfCores) As [Count CPU cores],
Count(tblProcessor.Caption) As [Count physical CPUs]
From tblProcessor
Group By tblProcessor.AssetID) CPUCount On tblAssets.AssetID =
CPUCount.AssetID
Where tblAssets.Assettype = -1
Order By [Lansweeper Asset State],
tblAssets.AssetName,
[SQL edition]
‎06-10-2015 03:26 PM
‎06-10-2015 03:16 PM
Select Top 1000000 tblState.Statename As [Lansweeper Asset State],
tblAssets.AssetName,
tblAssets.AssetID,
tblAssets.Domain,
tblAssets.FQDN As [Machine Fully Qualified Name],
tblAssets.Lastseen As [Inventory Date],
tblOperatingsystem.Caption As OS,
tblSqlServers.serviceName As [SQL service name],
tSQLSoftware.softwareName As [SQL Version],
tblSqlServers.skuName As [SQL edition],
tblOperatingsystem.InstallDate As [Install date (OS)],
tSQLSoftware.Lastchanged As [Last software change date],
CPUCount.[Count physical CPUs],
CPUCount.[Count CPU cores],
CPUCount.[Count logical CPUs]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblAssetCustom.State = tblState.State
Left Join tblSqlServers On tblSqlServers.AssetID = tblAssets.AssetID
Inner Join (Select Top 1000000 tSQLSoftware.AssetID,
tSQLSoftware.softwareName,
tSQLSoftware.softwareVersion,
tSQLSoftware.Lastchanged,
tSQLSoftware.Installdate
From (Select Max(Case
When CharIndex('(', tblSoftwareUni.softwareName) >
0 Then SubString(tblSoftwareUni.softwareName, 1, CharIndex('(',
tblSoftwareUni.softwareName) - 1) Else tblSoftwareUni.softwareName
End) As softwarename,
tblSoftware.AssetID
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName In ('Microsoft SQL Server 2000',
'Microsoft SQL Server 2005', 'Microsoft SQL Server 2008',
'Microsoft SQL Server 2008 R2', 'Microsoft SQL Server 2008 (64-bit)',
'Microsoft SQL Server 2008 R2 (64-bit)', 'Microsoft SQL Server 2012',
'Microsoft SQL Server 2014', 'Microsoft SQL Server 2012 (64-bit)',
'Microsoft SQL Server 2014 (64-bit)')
Group By tblSoftware.AssetID) tSQLHighest
Inner Join (Select tblSoftware.Lastchanged,
tblSoftware.Installdate,
tblSoftware.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID)
tSQLSoftware On tSQLHighest.AssetID = tSQLSoftware.AssetID And
Replace(tSQLHighest.softwarename, ' ', '*') = Replace(Case
When CharIndex('(', tSQLSoftware.softwareName) >
0 Then SubString(tSQLSoftware.softwareName, 1, CharIndex('(',
tSQLSoftware.softwareName) - 1) Else tSQLSoftware.softwareName
End, ' ', '*')) tSQLSoftware On tSQLSoftware.AssetID = tblAssets.AssetID
Left Join tblOperatingsystem On tblOperatingsystem.AssetID = tblAssets.AssetID
Left Join (Select tblProcessor.AssetID,
Sum(tblProcessor.NumberOfLogicalProcessors) As [Count logical CPUs],
Sum(tblProcessor.NumberOfCores) As [Count CPU cores],
Count(tblProcessor.Caption) As [Count physical CPUs]
From tblProcessor
Group By tblProcessor.AssetID) CPUCount On tblAssets.AssetID =
CPUCount.AssetID
Where tblAssets.Assettype = -1
Order By [Lansweeper Asset State],
tblAssets.AssetName,
[SQL edition]
‎06-10-2015 08:50 AM
‎06-09-2015 08:21 PM
Select Top 1000000 tblState.Statename As [Lansweeper Asset State],
tblAssets.AssetName,
tblAssets.AssetID,
tblAssets.Domain,
tblAssets.FQDN As [Machine Fully Qualified Name],
tblAssets.Lastseen As [Inventory Date],
tblOperatingsystem.Caption As OS,
tblSqlServers.serviceName As [SQL service name],
tSQLSoftware.softwareName As [SQL Version],
tblSqlServers.skuName As [SQL edition],
tSQLSoftware.Installdate As [Install date],
tSQLSoftware.Lastchanged As [Last software change date],
CPUCount.[Count physical CPUs],
CPUCount.[Count CPU cores],
CPUCount.[Count logical CPUs]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblAssetCustom.State = tblState.State
Left Join tblSqlServers On tblSqlServers.AssetID = tblAssets.AssetID
Inner Join (Select Top 1000000 tSQLSoftware.AssetID,
tSQLSoftware.softwareName,
tSQLSoftware.softwareVersion,
tSQLSoftware.Lastchanged,
tSQLSoftware.Installdate
From (Select Max(Case
When CharIndex('(', tblSoftwareUni.softwareName) >
0 Then SubString(tblSoftwareUni.softwareName, 1, CharIndex('(',
tblSoftwareUni.softwareName) - 1) Else tblSoftwareUni.softwareName
End) As softwarename,
tblSoftware.AssetID
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID
Where tblSoftwareUni.softwareName In ('Microsoft SQL Server 2000',
'Microsoft SQL Server 2005', 'Microsoft SQL Server 2008',
'Microsoft SQL Server 2008 R2', 'Microsoft SQL Server 2008 (64-bit)',
'Microsoft SQL Server 2008 R2 (64-bit)', 'Microsoft SQL Server 2012',
'Microsoft SQL Server 2014', 'Microsoft SQL Server 2012 (64-bit)',
'Microsoft SQL Server 2014 (64-bit)')
Group By tblSoftware.AssetID) tSQLHighest
Inner Join (Select tblSoftware.Lastchanged,
tblSoftware.Installdate,
tblSoftware.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion
From tblSoftware
Inner Join tblSoftwareUni On tblSoftware.softID = tblSoftwareUni.SoftID)
tSQLSoftware On tSQLHighest.AssetID = tSQLSoftware.AssetID And
Replace(tSQLHighest.softwarename, ' ', '*') = Replace(Case
When CharIndex('(', tSQLSoftware.softwareName) >
0 Then SubString(tSQLSoftware.softwareName, 1, CharIndex('(',
tSQLSoftware.softwareName) - 1) Else tSQLSoftware.softwareName
End, ' ', '*')) tSQLSoftware On tSQLSoftware.AssetID = tblAssets.AssetID
Left Join tblOperatingsystem On tblOperatingsystem.AssetID = tblAssets.AssetID
Left Join (Select tblProcessor.AssetID,
Sum(tblProcessor.NumberOfLogicalProcessors) As [Count logical CPUs],
Sum(tblProcessor.NumberOfCores) As [Count CPU cores],
Count(tblProcessor.Caption) As [Count physical CPUs]
From tblProcessor
Group By tblProcessor.AssetID) CPUCount On tblAssets.AssetID =
CPUCount.AssetID
Where tblAssets.Assettype = -1
Order By [Lansweeper Asset State],
tblAssets.AssetName,
[SQL edition]
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now