Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

SSIS 2012 dts.variable not declared

Posted on 2014-02-21
Last Modified: 2016-02-10
Hi All,
I am migrating an existing package, working packages, from SQL2005 to SQL2012.
I have variables that are passed/used in a Script Task.  My problem is the Dts.Variables statement does not recognize the "dts.".
Says it's not declared.  I don't understand why it works find on my production server (SQL2005) and not here.
I also tried finding the assemblies needed and one article mentioned Microsoft.SqlServer.ScriptTask; but I can't find this.

Below is the my first problem string....
Dim File_Name$ = DTS.Variables("User::DB_File_Name").Value.ToString

Any help would be greatly appreciated it.
Question by:Thunder724
  • 3
LVL 65

Expert Comment

by:Jim Horn
ID: 39877382
Make sure User::DB_File_Name is listed in either ReadOnlyVariables or ReadWriteVariables, then..

Dim File_Name as String
SET File_name = DTS.Variables("DB_File_Name").Value.ToString

Author Comment

ID: 39877515
yup, they are.  Exact same project that is working on the other box.

Accepted Solution

Thunder724 earned 0 total points
ID: 39877567
Think I got it.
I needed to add the following to the class of the file......

'ScriptMain is the entry point class of the script.  Do not change the name, attributes,
    'or parent of this class.
    <Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()> _
    <System.CLSCompliantAttribute(False)> _
    Partial Public Class ScriptMain
        Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

Author Closing Comment

ID: 39888299
I figured the problem out.

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
My client sends a request to me that they want me to load data, which will be returned by Web Service APIs, and do some transformation before importing to database. In this article, I will provide an approach to load data with Web Service Task and X…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question