cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
BadenhoA
Engaged Sweeper
Is there a way to run a stored procedure when using SQL datanase to return a report. I am trying to pull a report of all Auto desk products installed. When using the following query:
Select Distinct Top 1000000 tblSoftwareUni.softwareName,
tblAssets.AssetUnique,
tblAssets.Username,
tblAssets.AssetID,
tblSoftwareUni.SoftwarePublisher,
tblSerialnumber.ProductKey
From tblAssets
Inner Join tblSoftware On tblAssets.AssetID = tblSoftware.AssetID
Inner Join tblSoftwareUni On tblSoftwareUni.SoftID = tblSoftware.softID
Inner Join tblSerialnumber On tblAssets.AssetID = tblSerialnumber.AssetID
Where tblSoftwareUni.SoftwarePublisher Like 'Auto%'
Extract of the result looks like this:
A360 Desktop Bmsit0002 HerselmanG Autodesk 1143-4007-4388-8635-8450-4419
A360 Desktop Bmsit0002 HerselmanG Autodesk GYJRG-NMYMF-VGBM4-T3QD4-842DW
A360 Desktop Bmsit0002 HerselmanG Autodesk NPPR9-FWDCX-D2C8J-H872K-2YT43
A360 Desktop Bmsit0002 HerselmanG Autodesk PD3PC-RHNGV-FXJ29-8JK7D-RJRJK
A360 Desktop Bmsit0002 HerselmanG Autodesk XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99

As you can see due to the wrong asset ID being extracted I cannot use destinct to get a single entry for example A360

The query above at least finds all the various products albeit many duplicates.

The following code:
Select Top 1000000 tblAssets.AssetID,
  tblAssets.AssetUnique,
  tblAssets.Domain,
  tsysOS.OSname,
  tsysOS.Image As icon,
  tblSerialnumber.Product,
  tblSerialnumber.ProductKey,
  tblSerialnumber.ProductID
From tblAssets
  Inner Join tblSerialnumber On tblAssets.AssetID = tblSerialnumber.AssetID
  Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
  Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Where tblSerialnumber.Product Like 'Autocad%' And tblAssetCustom.State = 1
Order By tblSerialnumber.Product,
  tblAssets.AssetName

Results in only 40 Detected PC's and 5 Autodesk products, while we own 98 Licenses and about 15 diffrent Autodesk products and have about ~120 pc's as some of our owned licenses are network based licenses.
I have written a stored procedure that resolves this problem but I am only able to run it via SSMS console, as the code for the stored procedure does not run from lansweeper either due to creation of temporary tables etc.




1 REPLY 1
BadenhoA
Engaged Sweeper
Never Mind this request. I created a new table in lansweeperdb from which I pull the report. The stored procedure that creates the table runs every few hours to ensure that it is up to date.
THanKs