26-10-21 02:40 PM
Guys, good morning, I noticed that some people are wanting a way to get information about the licenses, so I had the idea to work on it, the result follows, a query that returns information such as company name, Expiration date and how many days are left missing, I hope it's useful for you:
select
issue_to as 'Name of Company',
FORMAT(License_expires_on,'dd/MM/yyyy') 'Date of validate',
datediff(day, getdate(), License_expires_on) 'Days Remaining'
from
(
select
cast (lic.licensexml as xml).value('(/license//licensee/node())[1]', 'nvarchar(10)') as [issue_to],
cast(cast(lic.licensexml as xml).value('(/license//expires/node())[1]', 'nvarchar(10)') as date) as [License_expires_on],
cast(lic.licensexml as xml).value('(/license//maxconcurrentsessions/node())[1]', 'nvarchar(10)') as [available_licences]
from
(
select
convert (varchar(2000), cast(' ' as xml).value('xs:base64Binary(sql:column("base64_column"))', 'VARBINARY(2000)')) AS LICENSEXML
FROM
(
select
licensekey as base64_column
from
bpalicense
)
a
)
lic
)
as pog
where
pog.License_expires_on >= getdate()
order by
pog.License_expires_on
#BPTechTips #License #Helpfull
------------------------------
Emerson Ferreira
Sr Business Analyst
Avanade Brasil
Recife
+5581988869544
If my answer helped you? Mark as useful!
------------------------------
27-10-21 12:53 PM
27-10-21 01:15 PM
Public Function GetLicenses() As DataTable
Dim LicenseInfo As List(Of KeyInfo) = app.gSv.GetLicenseInfo()
Dim dt As New DataTable
dt.Columns.Add("Owner", GetType(System.String))
dt.Columns.Add("Start Date", GetType(System.DateTime))
dt.Columns.Add("Expiry Date", GetType(System.DateTime))
dt.Columns.Add("Sessions", GetType(System.Int16))
For Each ki As KeyInfo In LicenseInfo
Dim dr As DataRow = dt.NewRow
dr("Owner") = ki.LicenseOwner()
dr("Start Date") = ki.StartDate()
dr("Expiry Date") = ki.ExpiryDate()
dr("Sessions") = ki.NumConcurrentSessions()
dt.Rows.Add(dr)
Next
Return dt
End Function
License_Information = GetLicenses()
27-10-21 04:35 PM
30-10-21 06:49 AM
30-10-21 09:11 AM
30-10-21 11:10 AM