sqlRead()
Returns a value from the database and stores it to a named variable by running a selected SQL "read" statement. Global "read" statements are specified in the following location: <Kaseya_Installation_Directory>
\xml\Procedures\AgentProcSQL\0\SQLRead\<filename.xml>
Filenames can be any name with an .xml
extension so long as they are formatted correctly internally. Multiple statements specified using one or more XML files display as a single combined combo box list in the user interface. Each SQL statement in the XML file has a unique label, and only the labels are shown in the combo box. If no SQL statements are defined, then *No Approved SQL*
displays in the combo box.
Partition-Specific Statements
Partition-specific folders can contain partition-specific SQL statements. For example: <Kaseya_Installation_Directory>\xml\Procedures\AgentProcSQL\123456789\SQLRead\<filename.xml>
.
Users can select and run all 0
folder SQL "read" statements and all SQL "read" statements located in the partition path that matches the partition they are using.
Example Format
<?xml version="1.0" encoding="utf-8" ?>
<queryList>
<queryDef label="Agent Machine Name" sql="SELECT machName FROM dbo.machNameTab WHERE agentGuid = #vMachine.agentGuid#" />
</queryList>
Example
sqlRead("Agent Machine Name", "machname", "All Operating Systems", "Halt on Fail")
sendMessage("#machname#", "Display now", "All Operating Systems", "Halt on Fail")