Kaseya Community

Free license counts in Report

This question is answered

I am setting up a report directly out of the SQL database with Report builder and am trying to figure out how to get the total number of available KAV licenses, so I can include it in a report with the number of licenses expiring each month.

I can get the license count currently in use and when they expire and have found the table dbo.vdb_LicenseValues which gives me the total number of licenses purchased, but I still need to get the expired number to make the calculation properly. In this table there is a field 'usageDbFunction' which lists 'kav.fnGetKAVUsedLicenseCount' as the value but I am then unable to find where this value is in the database.

Any suggestions?

Verified Answer
  • You'll find that it's a function, not a value - load the DB up in SQL management studio, drill down into Programmability - Functions - Scalar-valued Functions and look in there.

    When you reference the function, it returns an INT (number) directly, that you can use however you want.

    I only have KES; however this works for me:

    print @dbo.fnGetKESExpired('1')

    note: the 1 = the PartitonID (Usually 1 unless, you're on SAAS).

    if you can only work with tables, try this:

    use ksubscribers

    declare @expired table

    (

     ExpCount int

    )

    insert into @expired ("ExpCount) values ( @dbo.fnGetKESExpired('1') )

    then you just do a select * from @expired and off you go....

All Replies
  • You'll find that it's a function, not a value - load the DB up in SQL management studio, drill down into Programmability - Functions - Scalar-valued Functions and look in there.

    When you reference the function, it returns an INT (number) directly, that you can use however you want.

    I only have KES; however this works for me:

    print @dbo.fnGetKESExpired('1')

    note: the 1 = the PartitonID (Usually 1 unless, you're on SAAS).

    if you can only work with tables, try this:

    use ksubscribers

    declare @expired table

    (

     ExpCount int

    )

    insert into @expired ("ExpCount) values ( @dbo.fnGetKESExpired('1') )

    then you just do a select * from @expired and off you go....

  • Awesome Craig, that was exactly what I needed