Query Database Statement

Use the Task Query Database Statement to run an SQL (Structured Query Language) query on a database. This allows you to query your database with Ivanti Automation.

It is very useful to use Module parameters in this Task. This allows you to make it generic: when you schedule the Task, you will then be prompted for example for the database server, the database name and the login credentials.

Configuration

Settings tab

  • If you run the SQL script on a Microsoft SQL Server-based Datastore, select in the Database authentication field whether to connect to this Datastore using SQL Server Authentication or Windows Authentication. This field is only enabled when selecting Microsoft SQL Server in the Database type field.
    • When selecting Windows Authentication, specify logins in the format Domain\User name or Domain\Group name.

Script tab

  • Scripts can be typed in directly.
  • Use the File extension of script field to specify the file extension that Ivanti Automation should use. This extension is used to save the script as a script file in the specified format when the Task is executed. Ivanti Automation will save this file in the temporary folder on the Agent that executes the Task.
  • Use the Open in editor button to open an external editor that is associated with the specified file extension in the File extension of script field. This makes it easier to create complex scripts and troubleshoot existing ones. After creating or editing the script, it will be copied from the external editor to the Script tab. For more information on how to configure file associations, see http://msdn.microsoft.com/en-us/library/windows/desktop/cc144175%28v=vs.85%29.aspx.
  • Log and error files are included in the detailed Job History.

The Script tab has a limit of 64KB. If you use an external editor to edit a script, Ivanti Automation will disregard any characters that exceed this limit.