Stored SQL Procedures |
The following stored procedures are supported for maintenance of the BarTender System Database:
The SpDeleteOlderRecords procedure removes database records that are older than a specified amount of time. It takes three parameters:
@timeThreshold is an integer specifying the number of units in the past
@timeUnits specifies the measurement units of time, where 0 = days, 1 = weeks, and 2 = months
@recordType specifies the type of records to remove, where:
Constant |
Description |
---|---|
BTMS |
BarTender Messages |
BTLI |
BarTender Printed Item Images |
BTLD |
BarTender Item Database |
BTPJ |
BarTender Print Jobs |
BTFB |
BarTender Document Blobs |
BTFM |
BarTender Documents |
APMS |
Application Messages |
PMPR |
Printer Maestro Printer Events |
PMIN |
Printer Maestro Inventory Events |
SCEV |
Security Center Events |
ALLR |
All Records |
The following example deletes all records older than 6 months.
|
BarTender now supports maintenance of a remote BarTender Database. Maintenance can be locked, so that only one BarTender System Service executes it at a time. As a result, 'SpDeleteOlderRecords' was altered to include a "use lock" input parameter and a "lock host" output parameter. If "use lock" is nonzero, the stored procedure will attempt to lock the maintenance function. If the lock fails, the procedure will return -9 in the "result" output parameter, and the name of the host computer currently holding the lock in the "lock host" output parameter. If the procedure succeeds, the "result" will be 1. If only one BarTender System Service is connected to a particular SQL Server Database, the "use lock" parameter can be zero, and no lock attempt will be made (because it's not necessary). |
DECLARE @timeThreshold int
DECLARE @timeUnits int
DECLARE @recordType nvarchar(1024)
DECLARE @useLock int
DECLARE @lockHost nvarchar(1024)
DECLARE @result int
DECLARE @numRows int
SET @timeThreshold = 6
SET @timeUnits = 2
SET @recordType = N'ALLR'
SET @useLock = 1
SET @result = 0
EXEC [dbo].[SpDeleteOlderRecords] @timeThreshold, @timeUnits, @recordType, @useLock, @lockHost output, @result output
The SpPurgeDatabase procedure removes all logged data contained in the BarTender System Database. In times of heavy logging, do not use this procedure, as this process may interfere with the logging operations in process by the BarTender System Database. The SpPurgeDatabase procedure contains no additional parameters.
|
The SpPurgeDatabase procedure is non-reversible. Therefore, you will be unable to retrieve any records that have been purged from the database. Use with caution. |
The following example purges all records from the database.
EXEC dbo.SpPurgeDatabase