GVCustomTask Step by Step Guide



A step by step guide for the GVCustomTask written in response to a newsgroup posting:

Here is a step by step guide.

  1. Download and extract GVCustomTask.dll to a suitable location
  2. Open Enterprise Manager and create a New Package
  3. From the Task menu select Register Custom Task
  4. Supply a suitable description, and browse for the DLL & ICO files to
    where you placed them in step 1
  5. Create a New global variable from the Package Properties dialog
  6. Add an Active Script Task, and place the relevant code to assign a
    value as required to the global variable. (As per you code above)
  7. Add the GVCustomTask. Just click OK for the Custom Task Properties
    sheet
  8. Add a SQL Server Connection
  9. Add an Execute SQL Task. Just put — in the code for now
  10. Link the task with On Success workflow constraints:
    Active Script -> GVCustomTask -> Execute SQL Task
  11. Run the package
  12. Open Execute SQL Task, and you will some new lines of code that
    declares the global variable and sets it to the current value
  13. Now add your SQL code below that added by GVCustomTask. Do not alter
    the GVCustomTask produced code These lines are prefixed with
    /*GlobalVariableToSQL*/
  14. Now you are ready to go.

The reason for putting in the SQL code at stage 8, is that if you put
your full code in it will give a syntax error and not allow you to close
the box as the variables have not yet been declared. When you run the
Pkg, GVCustomTask reads the global variables and builds the SQL to
declare and set the variables. It then places this code at the top of
any existing code.

The point of the /*GlobalVariableToSQL*/ text before the declare and set
is so that next time you run the Pkg the GVCustomTask will remove any
lines prefixed with this and then add the new code it has built. This
prevents you getting duplicate declarations of variables. It also means
you are always using the current Global Variables.

Latest Articles