Reveal AI Billing Script
Reveal AI utilizes monthly usage reports in order to provide feedback during monthly/quarterly business reviews, and if applicable, confirm your license has not been exceeded. We request that these reports be filed by the 5th of every month.
Reveal Support offers an automated audit script to gather current usage and capacity details (no confidential data) and summarize the results in a text file for review by Reveal. No actual user or dataset details are included in the script output, only data metrics.
1. Copy the following script into a text file named Billing v5.sql.
2. Run the script.
3. Export into a .CSV format.
4. Send to reports@revealdata.com.
use nexlpadmin
--create table #tempTable(name varchar(500), current_cnt int)
IF OBJECT_ID (N'nexlp.NexLPBilling', N'U') IS NULL
create table nexlp.NexLPBilling (Id int identity primary key, name varchar(500), current_cnt int, DateRun datetime, RunCounter int)
IF NOt EXISTS(SELECT 1 FROM sys.columns
WHERE Name = N'StoryBookID'
AND Object_ID = Object_ID(N'nexlp.NexLPBilling'))
alter table nexlp.NexLPBilling add StoryBookID int
IF NOt EXISTS(SELECT 1 FROM sys.columns
WHERE Name = N'Last_COSMIC_Time'
AND Object_ID = Object_ID(N'nexlp.NexLPBilling'))
alter table nexlp.NexLPBilling add Last_COSMIC_Time DateTime
IF NOt EXISTS(SELECT 1 FROM sys.columns
WHERE Name = N'Last_Processing_Time'
AND Object_ID = Object_ID(N'nexlp.NexLPBilling'))
alter table nexlp.NexLPBilling add Last_Processing_Time DateTime
IF NOt EXISTS(SELECT 1 FROM sys.columns
WHERE Name = N'StoryBookCreationTime'
AND Object_ID = Object_ID(N'nexlp.NexLPBilling'))
alter table nexlp.NexLPBilling add StoryBookCreationTime Datetime
declare @run int
select @run = coalesce(max(RunCounter), 0) + 1 from nexlp.NexLPBilling
declare @storybookid as int
declare @name as varchar(500)
declare @dbname as varchar(500)
declare @creationtime as datetime
declare @sql as varchar(2000)
declare cur cursor for
select id, name, outputdatabasename, CreatedDate from nexlp.storybook
open cur
fetch cur into @storybookid, @name, @dbname, @creationtime
while (@@FETCH_STATUS = 0)
begin
set @sql = 'insert into nexlp.NexLPBilling( name, StoryBookID, StoryBookCreationTime, current_cnt, DateRun, RunCounter) ' + 'select ''' + replace(@name, '''', '''''') + ''' as name, ' + cast(@storybookid as varchar(10)) + ', ''' + cast(@creationtime as varchar(20)) + ''', count(*) as current_cnt, GetDate(), ' + cast(@run as varchar(10)) + ' from [' + @dbname + '].nexlp.copy '
exec(@sql)
--print(@sql)
fetch cur into @storybookid, @name, @dbname, @creationtime
end
close cur
deallocate cur
update a set a.Last_COSMIC_Time = (select top 1 CreatedDate from nexlp.ActiveLearningProcessQueue where storybookid = a.storybookid order by CreatedDate desc)
from nexlp.NexLPBilling a where RunCounter = @run
update a set a.Last_Processing_Time = (select top 1 CreatedDate from nexlp.ProcessingJob where OutputStorybookId = a.storybookid order by CreatedDate desc)
from nexlp.NexLPBilling a where RunCounter = @run
select StoryBookID, b.Name, current_cnt as Totalcount, StoryBookCreationTime, Last_Processing_Time, Last_COSMIC_Time, RunCounter
from nexlp.NexLPBilling a inner join nexlp.Storybook b on a.StoryBookID = b.Id where RunCounter = @run
select sum(current_cnt) as EnvironmentTotal from nexlp.NexLPBilling where RunCounter = @run
Please send as soon as you can or let us know if you have any questions by contacting support@revealdata.com.