Home
SQL Size online help Prev Page Prev Page
Introduction
About SQL Size
Version history
Contact us
User Guide
Architecture
Licensing
Installation
System requirements
Reference Guide
The SQL Size Agent service
The SQL Size Configuration application
SQL Server instances
Data collection schedule
Reports and emails
Report template
Data storage
Alerts
Script editor
Useful shortcuts
Activating your license
The SQL Size database
The SQL Size GUI
The Overview page
Export overview
Database analysis
Alerts history
Error history
Scripting
Data types
Script structure
Language basics
Debugging
Global variables
Functions
Alert functions
RaiseAlert
RaiseConditionalAlert
AddAlertDetails
Mathematical functions
Power
String formatting functions
FormatBytes
FormatFloat
Support functions
String functions
Date and time functions
Date-Time format strings
Class reference
TBaseClass
Properties
AverageDailyGrowth
Name
ObjectType
Size
SizeDesc
Tag
TInstance
Properties
Database
DatabaseByName
DatabaseCount
DatabaseDataSize
DatabaseExists
DatabaseFilestreamSize
DatabaseLogSize
DatabaseSize
PathCount
Path
TDatabase
Properties
DataSize
DBFile
DBFileCount
Filegroup
FilegroupCount
FilestreamSize
LogSize
TFilegroup
Properties
DBFile
DBFileCount
FilegroupType
TDBFile
Properties
Filegroup
FileType
Growth
IsPercentGrowth
MaxSize
Path
PhysicalName
TPath
Properties
FreeSpace
Enumerations
TFileType
TFilegroupType
TObjectType
Records
TGrowthStats
Constants

Language basics

The scripting language is not case sensitive, thus the following script is valid:

scripts_basics_01  

Arrays are 0-based. For example, a TInstance object contains an array of TDatabase objects. You can find out the number of databases using the DatabaseCount function, and get a reference to each database using the Database function. However, to loop through each database, you need to start with an index of 0, and the last column will have an index of DatabaseCount - 1. Example:

scripts_structure_04  

There are 2 kinds of loops you can use - a for loop and a repeat..until loop.

scripts_basics_03  
 
scripts_basics_04  


The assignment operator is :=, and the equality operator is =. Example:

scripts_basics_06  


Comments come in 2 forms - inline comments and block comments. Example:

scripts_basics_05