This report returns all computers with Office versions whose third number is less than 12228.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Username,
tsysOS.Image As icon,
tblSoftwareUni.softwareName,
tblSoftware.softwareVersion,
' ' As _,
Convert(bigint,Stuff(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion), Len(tblSoftware.softwareVersion) -
CharIndex('.', tblSoftware.softwareVersion) + 1, '')) As A1,
Convert(bigint,Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1), CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)),
Len(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)) - Len(CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1))), '')) As B1,
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) -
Len(CharIndex('.', Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) As C1,
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), 1, CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) +
1 - CharIndex('.', tblSoftware.softwareVersion) + 1)), '')), '')) As D1,
' ' As __,
Case
When Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) - Len(CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) <
12228 Then 'C1 kleiner'
When Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) - Len(CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) = 12228 And
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), 1, CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')), '')) >
20332 Then 'C1 gleich, D1 groesser'
When Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) - Len(CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) = 12228 And
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), 1, CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')), '')) =
20332 Then 'C1 gleich, D1 gleich pruef'
When Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) - Len(CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) = 12228 And
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), 1, CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')), '')) <
20332 Then 'C1 gleich, D1 kleiner' End As [Version pruef],
' ' As ___,
tblAssets.IPAddress,
tsysOS.OSname As OS
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Left Join tsysOS On tsysOS.OScode = tblAssets.OScode
Where tblSoftwareUni.softwareName Like '%Microsoft Office 365%' And
((Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) -
Len(CharIndex('.', Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) = 12228 And
Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), 1, CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')), '')) < 20332) Or
(Convert(bigint,Stuff(Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''), CharIndex('.',
Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')),
Len(Stuff(SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), '')) -
Len(CharIndex('.', Stuff(SubString(tblSoftware.softwareVersion,
CharIndex('.', tblSoftware.softwareVersion) + 1,
Len(tblSoftware.softwareVersion) + 1 - CharIndex('.',
tblSoftware.softwareVersion) + 1), 1, CharIndex('.',
SubString(tblSoftware.softwareVersion, CharIndex('.',
tblSoftware.softwareVersion) + 1, Len(tblSoftware.softwareVersion) + 1 -
CharIndex('.', tblSoftware.softwareVersion) + 1)), ''))), '')) < 12228))
And tsysOS.OSname Like 'Win 10'
Order By tblAssets.AssetName