→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
abdallamahjoob
Engaged Sweeper
Guys, i don't have experience in Sql and i have a question, i have this report script:

Select Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tsysOS.OSname As OS,
tblAssets.SP As SP,
Ceiling(tblPhysicalMemoryArray.MaxCapacity / 1024) As MaxCapacity,
tblAssets.Memory,
tblVolume.Capacity
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Inner Join tblPhysicalMemory On tblAssets.AssetID = tblPhysicalMemory.AssetID
Inner Join tblPhysicalMemoryArray On tblAssets.AssetID =
tblPhysicalMemoryArray.AssetID
Inner Join tblVolume On tblAssets.AssetID = tblVolume.AssetID


I need to add the following columns:
HDD Total size in GB
HDD Free space in GB
RAM Slots used
RAM Slots available
RAM Slots free

i have found the following script:

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen As [last scan],
Sum(Cast(Cast(tblDiskdrives.Size As BigInt) / 1024 / 1024 / 1024 As Numeric))
As [Total size (GB)],
Sum(Cast(Cast(tblDiskdrives.Freespace As BigInt) / 1024 / 1024 /
1024 As Numeric)) As [Free in GB]
From tblAssets
Inner Join tblDiskdrives On tblAssets.AssetID = tblDiskdrives.AssetID
Group By tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Lastseen
Order By tblAssets.AssetID


When i try to add it i get the following error:

Invalid SELECT statement. Unexpected token "Select" at line 24, pos 1.: Unexpected token "Select" at line 24, column 1


Please help, thanks.
1 REPLY 1
Esben_D
Lansweeper Employee
Lansweeper Employee
Try creating a new report and deleting all the SQL code and copy/paste the SQL code you quoted. I tried your SQL code and it seems to work just fine.