‎02-22-2023 10:24 AM
Hello, this report used to work fine in the past, now I get this error message:
"Error: Fehler beim Konvertieren des varchar-Datentyps in bigint." , something like "Error converting the varchar-Datatype to bigint"
I havn´t changed anything in this report, i guess i just downloaded it here some years ago:
Select Top (1000000) SQ.OS,
SQ.[OS Version],
Count(SQ.[OS Version]) As Anzahl
From (Select tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tsysOS.OSname As OS,
tblAssets.OScode + '.' + tblAssets.BuildNumber As Build,
tblAssets.Version As [OS Version],
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tblAssets.IPAddress,
tblAssets.Description,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Location,
tsysIPLocations.IPLocation,
tblAssets.Firstseen,
tblAssets.Lastseen,
Cast(Replace(Replace(Replace(tblAssets.OScode, '.', ''), 'S', ''), 'R',
'') As BIGINT) As OsCodeNumeric,
Cast(tblAssets.BuildNumber As INT) As BuildNumber
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tsysIPLocations On tblAssets.LocationID =
tsysIPLocations.LocationID
Where tsysOS.OSname = 'Win 10' And tblAssetCustom.State = 1 And
tblAssets.BuildNumber Is Not Null) SQ
Cross Join (Select Max(os1.OSCodeNumeric) MaxOsCodeNumeric
From tsysOS os1
Where os1.Sortorder = 18) mo
Cross Join (Select Max(Cast(a.BuildNumber As INT)) MaxBuildNumber
From tblAssets a
Inner Join tsysOS As o On o.OScode = a.OScode
Where o.OSname = 'Win 10' And a.BuildNumber Is Not Null And
Cast(Replace(Replace(Replace(a.OScode, '.', ''), 'S', ''), 'R',
'') As BIGINT) = (Select Max(os2.OSCodeNumeric) From tsysOS os2
Where os2.Sortorder = 18)) mb
Where (SQ.OsCodeNumeric < mo.MaxOsCodeNumeric) Or
(SQ.BuildNumber < mb.MaxBuildNumber)
Group By SQ.OS,
SQ.[OS Version]
Order By 'OS Version'
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now