Showing posts with label ssis. Show all posts
Showing posts with label ssis. Show all posts

Sunday, March 25, 2012

ActiveX transformations gone from SSIS?

In good old fashioned DTS there was the ability to perform custom transformations using activeX / vbscripty type language - does this still exist or are we stuck with the derived column editor?

I have never used DTS; but I know you can create Script tasks in the control flow and script components in the data flow.

Jamie Thomson has a series of post where he points some differences between DTS and SSIS:

http://blogs.conchango.com/jamiethomson/archive/2006/06/28/4156.aspx

|||

This does not still exist. You can either use the Derived Column transform or the Script Component transform.

One of the reasons this went away was the poor performance of using interpreted script. Another is that the built-in transforms in SSIS are so much more complete.

But the Derived Column transform could certainly use a better editor...

ActiveX Script Task] Error:

Hi,
I'm trying to reset the below Global varialbe in SSIS - Activex script.

Function Main()
DTSGlobalVariables("GxvFilename").value =null
Main = DTSTaskExecResult_Success
End Function

Getting the below Error when executing the package.

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x060339E4

Please provide me solution for this.

Thanks,

You can read and write global variables from ActiveX Script, but I have to ask why bother when you have the much more powerfull VB.net in the Script Task.

I don't belive null is a valid keyword in VBScript. Nothing is more usual, and use a Set statement. Saying all that I tried and got the same error. Unless anyone can come up with something better I'd say this is a backward compatability issue, and you woudl be better off moving to the Script Task.

|||

Thanks Darren,

The Activex Script is not working as like SQL 2000. We nee to use " " instead of null for resting the global variables.
MS need to give some reasonable error message for this kind of error.

Anyway I made it work in Activex Script iteself.

ActiveX Script Task] Error:

Hi,
I'm trying to reset the below Global varialbe in SSIS - Activex script.

Function Main()
DTSGlobalVariables("GxvFilename").value =null
Main = DTSTaskExecResult_Success
End Function

Getting the below Error when executing the package.

[ActiveX Script Task] Error: Retrieving the file name for a component failed with error code 0x060339E4

Please provide me solution for this.

Thanks,

You can read and write global variables from ActiveX Script, but I have to ask why bother when you have the much more powerfull VB.net in the Script Task.

I don't belive null is a valid keyword in VBScript. Nothing is more usual, and use a Set statement. Saying all that I tried and got the same error. Unless anyone can come up with something better I'd say this is a backward compatability issue, and you woudl be better off moving to the Script Task.

|||

Thanks Darren,

The Activex Script is not working as like SQL 2000. We nee to use " " instead of null for resting the global variables.
MS need to give some reasonable error message for this kind of error.

Anyway I made it work in Activex Script iteself.

ActiveX Script Task - SSIS

Within a SQL 2000 DTS Package I have an ActiveX Script that would go within my transform tasks and update the queries by concatenating a "Where" clause with a date from a database table. This way I could keep track of when the last time I updated the table so that I could only bring down the rows since the last run. How can this be done within SSIS? I've been looking and I'm getting confused. Any help would be greatly appreciated.

The most analogous thing to an ActiveX Script in SSIS is the script component but that isn't what you want to use here. Instead, set the SQL statement that pulls data from your source dynamically like so: http://blogs.conchango.com/jamiethomson/archive/2005/12/09/2480.aspx

-Jamie

|||

Jamie,

Thank you for your response. We went ahead and used a data flow with a RecordSet Destination. Then we used a "ForEach" loop to cycle through the RecordSet and run our query based on each value and then stored the data in a raw table.

Thanks again for all your help on this issue and others.

Jerry

sql

Tuesday, March 20, 2012

ACTIVE X SCRIPT ERROR

I have the following code in an ActiveX Script task for SSIS 2005 package... This worked about a year ago when it was first developed. I am coming in to try to update some things and i am running into this problem

Function Main()

Dim crDocument

Dim crApp

Dim sCRConnectionString

Dim crTable

strServer = DTSGlobalVariables("DBServer")

strDatabase = DTSGlobalVariables("DBName")

strCR = DTSGlobalVariables("CrystalReportPath")

strOutput = DTSGlobalVariables("OutputPath")

sFileOutputPDF = strOutput & "EventLogReport.pdf"

strReportLocation = strCR & "LoggedEvents.rpt"

Set crApp = CreateObject("CrystalRuntime.Application")

Set crDocument = crApp.OpenReport(strReportLocation )

sCRConnectionString = "Provider=SQLOLEDB;server=" & strServer & ";database=" & strDatabase & ";Integrated Security=True"

crDocument.DisplayProgressDialog = False

crDocument.ExportOptions.DestinationType = 1

crDocument.ExportOptions.DiskFileName = sFileOutputPDF

crDocument.ExportOptions.FormatType = 31

MSGBOX("EXPORTING..")

crDocument.Export(False)

MSGBOX("EXPORTING FINISHED!!")

Main = DTSTaskExecResult_Success

End Function

It makes it to the "Exporting.." msg box and then i get the following error

Error: 0xC0048006 at ActiveX Script Task, ActiveX Script Task: Retrieving the file name for a component failed with error code 0x0173DA5C.

At first I thought it may have been an issue with the crystal report having a popup or something come up while this was executing.. but I was able to open the crystal and export the data to a pdf no problem... Any suggestions?

Thanks in Advance!!!

Just an FYI - and not what you want to hear likely, but you should spend your time to convert this to an SSIS Script Task, written in VB.Net. ActiveX is a depricated feature of SSIS.

http://technet.microsoft.com/en-us/library/ms137525.aspx|||

how do i convert

Dim crDocument

Dim crApp

Set crApp = CreateObject("CrystalRuntime.Application")

Set crDocument = crApp.OpenReport(strReportLocation )

into VB.Net for the SSIS Script task... do i also need to import anything? when i right clicked references in the project explore window of the script task editor, i did not see any references that related to crystal?

Thanks in advance

Monday, March 19, 2012

Active Directory connection from SSIS

I'm trying to query against AD to grab some data. I've done this setup and got it to work at my location but can't get it working at one of my customers.

Per information I've found via this site I did the following:

Task: from SS2005, select data elements from Active Directory and populate in ODS (using an

SS2005 Package in SSIS)

  1. I created a linked server on the MS2005
    1. EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADSDSOObject', 'adsdatasource'
  2. I then created the following View (in the Master DB):

CREATE VIEW viewADContacts

AS

SELECT [NAME],MAIL

FROM OPENQUERY( ADSI,

'SELECT NAME, MAIL

FROM ''LDAP://#######/ DC=####,DC=###''

')

The View created w/ no errors

  1. When I execute

select * from viewADContacts

I get this error:

Cannot fetch a row from OLE DB provider "ADSDSOObject" for linked server "ADSI".

Any thoughts on this error? Again, I did the exact same thing at my office (against my local AD) and it worked fine.

Thanks in advance

Tom

Still stuck on this - I did install ldapbrowser on the Sql Server 2005 box and was able to query the Active Directory using my windows login (which is how I connect to the sql server). I'm thinking it's something w/ the Provider - any suggestions on how to debug?

thanks

|||

I've changed directions and am trying a Script task using the example from the SS online books

The code is this:

Public Sub Main()

Dim directory As DirectoryServices.DirectorySearcher

Dim result As DirectoryServices.SearchResult

Dim email As String

email = Dts.Variables("email").Value.ToString

Try

directory = New _

DirectoryServices.DirectorySearcher("(mail=" & email & ")")

result = directory.FindOne

Dts.Variables("name").Value = _

result.Properties("name").ToString()

Dts.TaskResult = Dts.Results.Success

Catch ex As Exception

Dts.Events.FireError(0, _

"Script Task Example", _

ex.Message & ControlChars.CrLf & ex.StackTrace, _

String.Empty, 0)

Dts.TaskResult = Dts.Results.Failure

End Try

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

My problem is I'm not getting a value for 'Name' instead when I display in a dataflow task (using dataviewer)following the script task the value of Name = 'System.DirectoryServices.ResultPropertyValueCollection'

It's seems like it is telling me its property not the value. I'm not a VB/.Net developer so I'm just guessing as to what the value means.

Any help would be appreciated.

thanks

Active Directory connection from SSIS

I'm trying to query against AD to grab some data. I've done this setup and got it to work at my location but can't get it working at one of my customers.

Per information I've found via this site I did the following:

Task: from SS2005, select data elements from Active Directory and populate in ODS (using an

SS2005 Package in SSIS)

  1. I created a linked server on the MS2005
    1. EXEC sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADSDSOObject', 'adsdatasource'
  2. I then created the following View (in the Master DB):

CREATE VIEW viewADContacts

AS

SELECT [NAME],MAIL

FROM OPENQUERY( ADSI,

'SELECT NAME, MAIL

FROM ''LDAP://#######/ DC=####,DC=###''

')

The View created w/ no errors

  1. When I execute

select * from viewADContacts

I get this error:

Cannot fetch a row from OLE DB provider "ADSDSOObject" for linked server "ADSI".

Any thoughts on this error? Again, I did the exact same thing at my office (against my local AD) and it worked fine.

Thanks in advance

Tom

Still stuck on this - I did install ldapbrowser on the Sql Server 2005 box and was able to query the Active Directory using my windows login (which is how I connect to the sql server). I'm thinking it's something w/ the Provider - any suggestions on how to debug?

thanks

|||

I've changed directions and am trying a Script task using the example from the SS online books

The code is this:

Public Sub Main()

Dim directory As DirectoryServices.DirectorySearcher

Dim result As DirectoryServices.SearchResult

Dim email As String

email = Dts.Variables("email").Value.ToString

Try

directory = New _

DirectoryServices.DirectorySearcher("(mail=" & email & ")")

result = directory.FindOne

Dts.Variables("name").Value = _

result.Properties("name").ToString()

Dts.TaskResult = Dts.Results.Success

Catch ex As Exception

Dts.Events.FireError(0, _

"Script Task Example", _

ex.Message & ControlChars.CrLf & ex.StackTrace, _

String.Empty, 0)

Dts.TaskResult = Dts.Results.Failure

End Try

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

My problem is I'm not getting a value for 'Name' instead when I display in a dataflow task (using dataviewer)following the script task the value of Name = 'System.DirectoryServices.ResultPropertyValueCollection'

It's seems like it is telling me its property not the value. I'm not a VB/.Net developer so I'm just guessing as to what the value means.

Any help would be appreciated.

thanks

Sunday, March 11, 2012

Active Directory access in SSIS

Does anyone have any examples of setting up a connection manager in SSIS to read information from Microsoft Active Directory? I would like to retrieve a list of users and populate them into a SQL Server table.

Thanks!
Harry

BOL has an example for a script task but it should be fairly straight forward to convert it to a script component. There is also an OLEDB driver for active directory that should be able to be used directly from the OLEDB source (although I don't know whether anyone has actually tried using it yet).

ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/dtsref9/html/a88fefbb-9ea2-4a86-b836-e71315bac68e.htm

HTH,

Matt

Thursday, March 8, 2012

activate or execute a ssis package from sharepoint document library

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

muhammad naeem wrote:

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

Michael Entin has a blog post that will help you here: http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

There are a number of ways of executing SSIS packages, you jest need to see which works best for your scenario.

-Jamie

|||

Hi Muhammad,

I have a similar requirement where on document upload in Sharepoint 2003 , I have to execute a SSIS package which will validate and store data in Database. Can you also tell me how you did it and whether it is working.

Regards,

Swati

|||

Hi swati

ya i can give you a idea that how am i done it

my issue is related with MOSS 2007 not on 2003.i start my work on SharePoint after the 2007 release so don’t know about that how can you do it on 2003 but here is the procedure which i use in moss 2007

I first create a work flow which have InfoPath form for configuration. in which i take the sp name the take two parameters one the url of the uploaded document and the other is the SSIS package name.

In this work flow I execute that sp by giving the ssis pacage name and the current document. In that sp a execute the dtsexe.exe(detail in linked below) to activate ssis package.

Then I attach this work flow with document library.

I got help from these two posts. You can too find more detail from them.

Michael Entin blog post

http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

and Jeff Modzel belogs

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp

if you need then I can give you code too.

|||

Hi Muhammad,

Thanks for your quick response. What is sp, if it is stored procedure, then how to take stored proc name in Infopath forms. Can you please send me the code, including the infopath form at pashmina_15@.yahoo.com

I need to learn how to create workflow and how to attach workflow with document library.

Also does this solution helps to solve the purpose, i.e. Whenever a new document is uploaded / updated to document library it will trigger SSIS package?

Thanks once again for your quick help.

Regards,

Swati

activate or execute a ssis package from sharepoint document library

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

muhammad naeem wrote:

hello all

i need to execute a ssis(sql 2005 integration service) on a document document library . can you people help me out how i can do it

i want to make a work flow which initiate when new document upload in a moss document library and this work flow pass the document to a ssis package and initiate that ssis package

note: the database and moss servers are on different machine

please reply ASAP if there any way to do it.

thnaks

Michael Entin has a blog post that will help you here: http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

There are a number of ways of executing SSIS packages, you jest need to see which works best for your scenario.

-Jamie

|||

Hi Muhammad,

I have a similar requirement where on document upload in Sharepoint 2003 , I have to execute a SSIS package which will validate and store data in Database. Can you also tell me how you did it and whether it is working.

Regards,

Swati

|||

Hi swati

ya i can give you a idea that how am i done it

my issue is related with MOSS 2007 not on 2003.i start my work on SharePoint after the 2007 release so don’t know about that how can you do it on 2003 but here is the procedure which i use in moss 2007

I first create a work flow which have InfoPath form for configuration. in which i take the sp name the take two parameters one the url of the uploaded document and the other is the SSIS package name.

In this work flow I execute that sp by giving the ssis pacage name and the current document. In that sp a execute the dtsexe.exe(detail in linked below) to activate ssis package.

Then I attach this work flow with document library.

I got help from these two posts. You can too find more detail from them.

Michael Entin blog post

http://blogs.msdn.com/michen/archive/2007/03/22/running-ssis-package-programmatically.aspx

and Jeff Modzel belogs

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp

if you need then I can give you code too.

|||

Hi Muhammad,

Thanks for your quick response. What is sp, if it is stored procedure, then how to take stored proc name in Infopath forms. Can you please send me the code, including the infopath form at pashmina_15@.yahoo.com

I need to learn how to create workflow and how to attach workflow with document library.

Also does this solution helps to solve the purpose, i.e. Whenever a new document is uploaded / updated to document library it will trigger SSIS package?

Thanks once again for your quick help.

Regards,

Swati

Acquiring Connection manager Programmatically in SSIS

hi all,

I m new to this forum and hope i ll get warm welcome from all of you.... thank you

I m Praveen kumar Dayanithi... a master student doin my assistantship in a Company. Kindly help me with this...

Here is my issue.... i would like to know how can i pass arguments to connection manager programmatically. In other words how can i acquire connection manger through SCRIPT task(Vb script). I know it is very easy to manually select n specify database name, table name by right clicking in dataflow task but in my company if i do that it will be very cumbersome for production people to change all the database and table names manually when the project is moved to production. Rather if i programmatically acquire connection manager using global variables it will make production people's job very easy. They have to just change the value of the variables. So can any one help me with this issue.

Thanks n regards

For dynamically changing configurations have you tried Package Configurations

Check out

http://msdn2.microsoft.com/en-us/library/ms141682.aspx
http://sqljunkies.com/WebLog/knight_reign/archive/2004/12/07/5445.aspx
http://www.sqlis.com/default.aspx?26

Thanks,
Loonysan

Tuesday, March 6, 2012

AcquireConnection Error - Lookup Component

Hi,

Trying to get a particular SSIS is package working - while running the Package Installation wizard a package is reported with the following errors:

    AcquireConnection method fails with error code 0xC0202009 Then Lookup fails validation and returns code 0xC020801C

The odd thing is the Lookup does not exist in the package, it did exist at one point but was deleted.

I have tried searching the XML and can't find any reference to the Lookup

Any suggestions appreciated...

Thanks,

John

Could you check if you are not somehow referencing the old package?|||

Any ideas how?

The steps I've tried are:

Delete all the packages in the server file system store

Check the local package for the Lookup (not found)

Rebuild the solution.

Double click the manifest to deploy on the server to a file store with the validate option turned on.

Validation warning above occurs.

If I open the package in notepad and search for the name of the lookup I don't find anything

|||

You may want to try a brute force here and search for all files with extension .dtsx on your machine. You could find some you do not know about (VS sometimes makes copies). If you do, see if any of them is the troublemaker.

HTH.

Friday, February 24, 2012

Accessing Variables in SSIS code

Hi

I am not able to access SSIS variables which are defined at Data Flow Task in a custom component. This custom component is developed by me in C#. How can i access these variables?

Please let me know if theres a way to access SSIS variables.

Thanks,

Vipul

To access the variables in code u need to use the Dispenser class given in Dts

Ex.

Dim vars As Variables
Dts.VariableDispenser.LockOneForRead("<SSISVariable name>", vars)
then use the value like this

vars("<SSISVariable name>").Value

if you want to modify the variable then lock the variable for Write like this


Dts.VariableDispenser.LockOneForWrite("<SSISVariable name>", vars)

Cheers

Atul

|||Custom data flow components, also known as pipeline components, inherit from the PipelineComponent class. This exposes a public read-only property called VariableDispenser, so you can access this in your own methiods, or those you override from the base class, PipelineComponent. This gives you access to the variable dispenser to read or write variables as you desire.|||

Hi Atul

Thanks for the reply.

After making use of VaribleDispenser i am able to get System variables. But when i am trying to access User variables, i m getting this error:

Error: 0xC0047062 at Data Flow Task, i2ADI [91672]: Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: Failed to lock variable "User::sourceId" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

> System.Runtime.InteropServices.COMException (0xC0010001): Failed to lock variable "User::sourceId" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

The only difference which i could figure out was that System vars are defined at Package level scope, while the user variables are defined at Data Task Flow level. Can this be the issue? Please let me know if you have some other pointers..

Thanks,

Vipul

|||

Hi Vipul:

A couple of things:

My experience has been that variables are scoped to the object that is selected when you add the variable to the project. If you happened to have a Data Task selected when you add a variable, it's scope will be that Data Task. You can most definately create variables that are scoped to the entire package -- just make sure to click anywhere on the white surface in the Control Flow outside of any task object (this action should de-select any selected object) before adding a variable.

You can verify a variable's scope in the Variables dialog. The Scope column contains either "Package" or the name of a task object (if the variable is scoped to a single object).

You can scope variables to a container, such as a ForEach Loop or Sequence Container. Then, all the tasks within the container "see" the variable.

Variable names are case-sensitive. In your example, you refer to "User::sourceId" -- you must have a variable named "sourceId", and not "SourceID" or any of a zillion different ways to case the name.

The code suggested by Atul should work for you.

I always use the "ReadVariable" and "WriteVariable" functions presented by Daniel Read in his excellent article:

http://www.developerdotstar.com/community/node/512

Just some thoughts.

|||

Hi Mike:

Thanks for the reply. This is the my part of code which i m using.

Microsoft.SqlServer.Dts.Runtime.Package pkg;

Variables sourceIdVar = null;

Microsoft.SqlServer.Dts.Runtime.VariableDispenser vd;

pkg = new Microsoft.SqlServer.Dts.Runtime.Package();

vd = pkg.VariableDispenser;

vd.LockForRead("System::PackageName");

vd.LockForRead("User::sourceId"); // <- accessing this variable is throwing exception

vd.GetVariables(ref sourceIdVar);

foreach (Microsoft.SqlServer.Dts.Runtime.Variable myVar in sourceIdVar)

{

Console.WriteLine("Name : " + myVar.Name);

Console.WriteLine("Description : " + myVar.Description);

}

Let me know your views on this part of code.

Thanks,

Vipul

|||

Hi Mike:

I was able to solve it. Code correction:

IDTSVariables90 variables = null;

this.VariableDispenser.LockForRead("User::dimSrcId");

this.VariableDispenser.GetVariables(out variables);

dimSrcId = variables["User::dimSrcId"].Value.ToString();

variables.Unlock();

Thanks for your help.

Vipul

|||

Hello

if i need to show all system variable in me Custom component what should i do

the code :

Dim Var As IDTSVariables90 = Nothing

Me.VariableDispenser.LockForWrite("System::StartTime")

Me.VariableDispenser.GetVariables(Var)

Var.Unlock()

Accessing Variables in SSIS code

Hi

I am not able to access SSIS variables which are defined at Data Flow Task in a custom component. This custom component is developed by me in C#. How can i access these variables?

Please let me know if theres a way to access SSIS variables.

Thanks,

Vipul

To access the variables in code u need to use the Dispenser class given in Dts

Ex.

Dim vars As Variables
Dts.VariableDispenser.LockOneForRead("<SSISVariable name>", vars)
then use the value like this

vars("<SSISVariable name>").Value

if you want to modify the variable then lock the variable for Write like this


Dts.VariableDispenser.LockOneForWrite("<SSISVariable name>", vars)

Cheers

Atul

|||Custom data flow components, also known as pipeline components, inherit from the PipelineComponent class. This exposes a public read-only property called VariableDispenser, so you can access this in your own methiods, or those you override from the base class, PipelineComponent. This gives you access to the variable dispenser to read or write variables as you desire.|||

Hi Atul

Thanks for the reply.

After making use of VaribleDispenser i am able to get System variables. But when i am trying to access User variables, i m getting this error:

Error: 0xC0047062 at Data Flow Task, i2ADI [91672]: Microsoft.SqlServer.Dts.Runtime.DtsRuntimeException: Failed to lock variable "User::sourceId" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

> System.Runtime.InteropServices.COMException (0xC0010001): Failed to lock variable "User::sourceId" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".

The only difference which i could figure out was that System vars are defined at Package level scope, while the user variables are defined at Data Task Flow level. Can this be the issue? Please let me know if you have some other pointers..

Thanks,

Vipul

|||

Hi Vipul:

A couple of things:

My experience has been that variables are scoped to the object that is selected when you add the variable to the project. If you happened to have a Data Task selected when you add a variable, it's scope will be that Data Task. You can most definately create variables that are scoped to the entire package -- just make sure to click anywhere on the white surface in the Control Flow outside of any task object (this action should de-select any selected object) before adding a variable.

You can verify a variable's scope in the Variables dialog. The Scope column contains either "Package" or the name of a task object (if the variable is scoped to a single object).

You can scope variables to a container, such as a ForEach Loop or Sequence Container. Then, all the tasks within the container "see" the variable.

Variable names are case-sensitive. In your example, you refer to "User::sourceId" -- you must have a variable named "sourceId", and not "SourceID" or any of a zillion different ways to case the name.

The code suggested by Atul should work for you.

I always use the "ReadVariable" and "WriteVariable" functions presented by Daniel Read in his excellent article:

http://www.developerdotstar.com/community/node/512

Just some thoughts.

|||

Hi Mike:

Thanks for the reply. This is the my part of code which i m using.

Microsoft.SqlServer.Dts.Runtime.Package pkg;

Variables sourceIdVar = null;

Microsoft.SqlServer.Dts.Runtime.VariableDispenser vd;

pkg = new Microsoft.SqlServer.Dts.Runtime.Package();

vd = pkg.VariableDispenser;

vd.LockForRead("System::PackageName");

vd.LockForRead("User::sourceId"); // <- accessing this variable is throwing exception

vd.GetVariables(ref sourceIdVar);

foreach (Microsoft.SqlServer.Dts.Runtime.Variable myVar in sourceIdVar)

{

Console.WriteLine("Name : " + myVar.Name);

Console.WriteLine("Description : " + myVar.Description);

}

Let me know your views on this part of code.

Thanks,

Vipul

|||

Hi Mike:

I was able to solve it. Code correction:

IDTSVariables90 variables = null;

this.VariableDispenser.LockForRead("User::dimSrcId");

this.VariableDispenser.GetVariables(out variables);

dimSrcId = variables["User::dimSrcId"].Value.ToString();

variables.Unlock();

Thanks for your help.

Vipul

|||

Hello

if i need to show all system variable in me Custom component what should i do

the code :

Dim Var As IDTSVariables90 = Nothing

Me.VariableDispenser.LockForWrite("System::StartTime")

Me.VariableDispenser.GetVariables(Var)

Var.Unlock()

Accessing variable inside Script Task

Hi,

I have a variable in SSIS that I want to access inside the Script Task. I assigned the variable in the ReadOnlyVariables in the Script Task property. How do I access it?

cherriesh

Try

Dim Avariable As Variables
Dts.VariableDispenser.LockForRead("YourPackageVariable")
Dts.VariableDispenser.GetVariables(Avariable)

see

Sunday, February 19, 2012

Accessing SSIS on servers with only Named Instances

Here's my problem:

I've entered a set of database maintenance plans in SQL 2005 and would like to export them to other servers. I've built four database servers on this Windows 2003 server, all named instances. One is SQL 2000, the others are all SQL 2005. SSIS is running on this Windows server using the server name, since it doesn't support multiple instances. The maintenance plans are all functioning properly.

I want to export the maintenance plans to other servers and the research I've done directs me to go into Integration Services, open up the MSDB database and select the packages there, and select export. The problem is that when I attempt to open up MSDB I always get a connection failure. I don't know which of the SQL Servers the maintenance plans are loaded into (well, I have a hunch, but it's very possible I'm wrong) and I can't figure out how to get the SSIS server opened up properly in Management Studio. I've tried changing the MsDtsSrvr.ini.xml file and setting the <ServerName>.</ServerName> value from "."to the name of the server I think contains the data, but that caused Integration Services to not come up after the restart.

The maintenance plans I developed were quite complex due to error handling steps I included, and I'd really rather not have to build them manually for each of my servers here.

Any assistance will be greatly appreciated.

Well, I solved the problem myself, by just slowing down a bit. I stopped Integration Services on the Windows Server, changed the MsDtsSrvr.ini.xml file <ServerName> setting to the name of the server I thought contained the maintenance plans, then restarted Integration Services. After that I was able to successfully connect to the SSIS and export the maintenance plans by opening up the MSDB database, drilling down to the maintenance plan I wanted to export, right-clicking, then selecting Export. I then entered the server name of the destination server (database server, not SSIS) and drilled down to the Maintenance Plans folder, and clicking OK.

The maint plans are now where I wanted them, without having to rebuild them for each server.