‎05-26-2016 09:36 PM
Solved! Go to Solution.
‎05-26-2016 10:33 PM
‎02-26-2020 05:03 PM
‎02-26-2020 08:43 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
ThirdPeriodQuery.softwareName,
ThirdPeriodQuery.softwareVersion,
Right('00000' + Left(ThirdPeriodQuery.softwareVersion, ThirdPeriodQuery.FirstPeriodPosition - 1), 5) +
Right('00000' + SubString(ThirdPeriodQuery.softwareVersion, ThirdPeriodQuery.FirstPeriodPosition + 1, ThirdPeriodQuery.SecondPeriodPosition - ThirdPeriodQuery.FirstPeriodPosition - 1), 5) +
Right('00000' +
Case
When ThirdPeriodQuery.ThirdPeriodPosition = 0 Then
Right(ThirdPeriodQuery.softwareVersion, ThirdPeriodQuery.VersionLength - ThirdPeriodQuery.SecondPeriodPosition)
Else
SubString(ThirdPeriodQuery.softwareVersion, ThirdPeriodQuery.SecondPeriodPosition + 1, ThirdPeriodQuery.ThirdPeriodPosition - ThirdPeriodQuery.SecondPeriodPosition - 1)
End, 5) +
Right('00000' +
Case
When ThirdPeriodQuery.ThirdPeriodPosition = 0 Then
''
Else
Right(ThirdPeriodQuery.softwareVersion, ThirdPeriodQuery.VersionLength - ThirdPeriodQuery.ThirdPeriodPosition)
End, 5) As ExpandedVersion
From tblAssets
Inner Join (Select tblAssets.AssetID,
SecondPeriodQuery.softwareName,
SecondPeriodQuery.softwareVersion,
SecondPeriodQuery.FirstPeriodPosition,
SecondPeriodQuery.SecondPeriodPosition,
SecondPeriodQuery.VersionLength,
CharIndex('.', SecondPeriodQuery.softwareVersion, SecondPeriodQuery.SecondPeriodPosition + 1) As ThirdPeriodPosition
From tblAssets
Inner Join (Select tblAssets.AssetID,
FirstPeriodQuery.softwareName,
FirstPeriodQuery.softwareVersion,
FirstPeriodQuery.FirstPeriodPosition,
FirstPeriodQuery.VersionLength,
CharIndex('.', FirstPeriodQuery.softwareVersion, FirstPeriodQuery.FirstPeriodPosition + 1) As SecondPeriodPosition
From tblAssets
Inner Join (Select tblAssets.AssetID,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion,
Len(tblSoftware.softwareVersion) As VersionLength,
CharIndex('.', tblSoftware.softwareVersion) As FirstPeriodPosition
From tblAssets
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Where tblSoftwareUni.softwareName Like 'Java [678]%')
FirstPeriodQuery On tblAssets.AssetID = FirstPeriodQuery.AssetID)
SecondPeriodQuery On tblAssets.AssetID = SecondPeriodQuery.AssetID)
ThirdPeriodQuery On tblAssets.AssetID = ThirdPeriodQuery.AssetID
‎02-26-2020 03:53 PM
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion,
Convert(int,SubString(tblSoftware.softwareVersion, 1, CharIndex('.',
tblSoftware.softwareVersion) - 1)) * 10000000 +
Convert(int,SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, CharIndex('.', tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1) - CharIndex('.',
tblSoftware.softwareVersion) - 1)) * 1000000 + Convert(int,Case
When CharIndex('.', tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1) + 1) = 0 Then SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1) + 1, Len(tblSoftware.softwareVersion) - CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1))
Else SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1) + 1, CharIndex('.', tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1) + 1) - CharIndex('.', tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1) - 1)
End) * 100 + Case
When CharIndex('.', tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion) +
1) + 1) = 0 Then 0
Else Convert(int,SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1) + 1) + 1,
Len(tblSoftware.softwareVersion) - CharIndex('.',
tblSoftware.softwareVersion, CharIndex('.', tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1) + 1)))
End As VersionNumberInteger
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Where tblSoftwareUni.softwareName Like 'Java [678]%' And tblAssetCustom.State =
1
‎05-27-2016 02:03 PM
‎05-26-2016 10:33 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now