Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Dec 28, 1999

GVCustomTask Step by Step Guide

By Darren Green

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.

MS SQL Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM