SHARE
Facebook X Pinterest WhatsApp

GVCustomTask Step by Step Guide

Written By
thumbnail
Darren Green
Darren Green
Dec 28, 1999



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.

Recommended for you...

Best Online Courses to Learn SQL
Ronnie Payne
Sep 23, 2022
Best Courses for Database Administrators
Ronnie Payne
Jul 22, 2022
Tip 74 – Changing Cost Threshold for Parallelism
Gregory Larsen
Feb 24, 2021
How Many Databases Can You Name?
Brad Jones
May 11, 2020
Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.