Will we be able to pass variables to the SQL script via the label
i.e The current method of using +++SQLCMD allows us to pass variables to it from the Agent procedure , so will we be able to replicate that functionality and pass 2 or more variables to the SQL contained in the XML file and have the result returned to the running procedure
The SQL string you approve gets executed in the script engine exactly as you type in and approve. So if you SQL string contains a script variable, then it gets used. It is exactly the same as +++sqlcmd:
The 6.3 upgrade has introduced the new method of executing SQL Commands
The change affects Service Desk Procedures .. but I cannot see any change to the Agent Procedure list of commands
You will need to add xml files into the following folders
Example syntax for the files is :
<?xml version="1.0" encoding="utf-8" ?>
<queryDef label="MySQLCommand" sql="SELECT machName FROM dbo.machNameTab WHERE agentGuid = '123456789' " />
I'd suggest creating the files BEFORE you upgrade
See help.kaseya.com/.../index.htm for more detail
The SQLRead and SQLWrite commands are now implemented in Agent Procedures .. and it looks like any workaround you had been using for the +++SQLCMD may now also have stopped working
This works until I make a second file containing SQL in the folder.
I am not clear on this part, documentation and this conversation sounds like I can create a separate file for each SQL statement or group of statements as long as they have unique labels.
When I have two SQL statements each in its own file the script editor hangs on reviving data from host, when I add the execute SQL command to the script in SD.
Edit: I have found the cause, in one of my SQL statements i had this "and online <> 0".
The angle brackets caused the phraser to fail. after I updated the statement to "and online != 0" it works properly.
@Paul Haaker - My workaround for SQLCMD is still working :)
Either I'm going Mad .. or a Hotfix came out .. as mine definitely had stopped working
Also @K Arnott ... I've got all my SQLread commands in a single file. haven't tested multiple files yet