How to create a task that runs a SQL script and then a Data Connector import rule

book

Article ID: 181774

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server)

Issue/Introduction

 

Resolution

A task can be created in the Symantec Management Platform Console that can run a SQL script and then run a Data Connector import rule. This can be useful if the SQL script is needing to be ran before the import rule runs, which in itself, through its data source, could run additional SQL scripts. This procedure can be used as a workaround as well for the data source change introduced in Data Connector 7.5, which is discussed in the following article:

Warning "This query contains at least one of the SQL statements that are unusual for data retrieval" occurs when using a Data Connector OLE DB data source that includes an import query
http://www.symantec.com/business/support/index?page=content&id=TECH216947
 

  1. In the Symantec Management Platform Console, click on the Manage button > Jobs and Tasks.
  2. Right click on the System Jobs and Tasks folder > New > Server Job.
  3. Click on the New Server Job name and change this to a new name. For example "Run a SQL Script and then an Import Rule".
  4. Click on the New button > Task.
  5. Near the bottom of the task list, locate and select Run SQL Query on Server.
  6. In the Sql Command box, type the SQL script to run. Note: If this SQL script is used for the workaround from TECH216947, include the SQL statements from the import rule's data source that are not designed to retrieve data. For example, if the data source's SQL script is the following:

    SET NO COUNT ON
    UPDATE RM_Resource Computer
    SET Name = 'New Name'
    WHERE GUID = '<GUID>'
    SELECT *
    FROM RM_Resource Computer

    Add just the top four lines as the task's SQL script:

    SET NO COUNT ON
    UPDATE RM_Resource Computer
    SET Name = 'New Name'
    WHERE GUID = '<GUID>'

     
  7. Click on the OK button.
  8. Click on the New button > Task.
  9. Locate and select, from the Server Tasks folder, Run Connector Rule.
  10. Click in the "Connector rule" drop-down list and select the Data Connector import rule to use. If this does not exist yet, cancel this, save the in-progress task, and create a Data Connector data source and import rule to use. For more information on how to use Data Connector, refer to the following article:

    How to import data into the Symantec Management Platform database using Data Connector
    http://www.symantec.com/business/support/index?page=content&id=HOWTO79380

    Note: If the select import rule is used for the workaround from TECH216947, remove the SQL statements from the import rule's data source that are not designed to retrieve data. For example, if the data source's SQL script is the following:

    SET NO COUNT ON
    UPDATE RM_Resource Computer
    SET Name = 'New Name'
    WHERE GUID = '<GUID>'
    SELECT *
    FROM RM_Resource Computer

    Remove the top four lines so that the data source's SQL script then looks like this:

    SELECT *
    FROM RM_Resource Computer
     
  11. Click on the OK button.
  12. Click on the "Save changes" button.
  13. Click on the New Schedule button. Run the task manually now, or, schedule this to run at a specified time.