How To Enable Or Disable A Task Programmatically Using Script Task

Mar 6, 2006

I have made one package which extracts data from the source does transformation and submits the data to destination. Subsequently it also updates the required control files.

Now I want to add a functionality :

If the package is executed again it should check the status of previous execution in control file if success mark all tasks disable and stop

if failure mark all tasks at enable and start extracting data and continue further with execution.

I was able to attain similar functionality in SQL Server 2000 using activeX script. What code do I need to write as a part of Script Task in order to attain above functionality.

View 3 Replies


ADVERTISEMENT

Disable And Enable A Task At RunTime In SSIS

Apr 24, 2008



Hi,

I have a package with 3 different tasks.
Like:

1. Execute Sql Task
2. Execute Sql Task
3. Execute Sql Task
4. Execute Sql Task

ESQL1 will get max(id) from table and then based on the ID the remaining needs to be work.

Ex:
If the ID=AUS-Sdy-1
then ESQL2 will update the tbl1 and return one IDkey based on this return key the ESQL3 will
update a tbl2. ----------*( i want to disable ESQL4)
else
If the ID=AUS-Sdy-2
then ESQL3 will update the tbl1 and return one IDkey based on this return key the ESQL4 will
update a tbl2. ----------- *(i want to disable ESQL2)


Thanks
Thiru

View 5 Replies View Related

Disable A Task In The Current Package Programmatically?

Dec 14, 2006

Hi,

I have a package comprising a number of Data Flow Task steps, to import various tables of data from some Access databases into SQL Server. The name of some of these Access databases will change depending on the date, e.g. last year's data is currently in a database called "2005data.mdb". At year end this will be superseded by "2006data.mdb". The Access databases are within a 3rd party system so I have no control over the file names.

I have a Script Task that checks the current date, and changes the name of an Access database in the connection string to reflect last year's date. But to complicate matters, last year's file might not exist.

So the Script Task checks whether the file name exists. If not, I would like to disable the Task that uses this connection. But how do I reference a task within the package that contains my Script Task, by name, to set the Disabled attribute to true?

I want to do something like CurrentPackage.Tasks("MyDataFlowTask").Disabled = True.

I would also welcome alternative suggestions for how to achieve this.

Many thanks,

Keith.

View 10 Replies View Related

Send Mail Task Problem Using A Combination Of ForEach Loop, Recordset Destination, Execute SQL Task And Script Task

Jun 21, 2007

OK. I give up and need help. Hopefully it's something minor ...



I have a dataflow which returns email addresses to a recordset.

I pass this recordset into a ForEachLoop configuring the enumerator as (Foreach ADO Enumerator). I also map the email address as a variable with index 0.



I then have a Execute SQL task which receives this email address as a varchar variable (parameter 0) which I then use in my SQL command to limit the rows returned. I have commented out the where clause and returned all rows regardless of email address to try to troubleshoot this problem. In either event, I then use a resultset to store the query result of type object and result name 0.



I then pass this resultset into a script variable to start parsing the sql rows returned as type object. ( I assume this is the correct way to do this from other prior posts ...).



The script appears to throw an exception at the following line. I assume it's because I'm either not passing in the values properly or the query doesn't return anything. However, I am certain the query works as it executes just fine at the command prompt.



Try

ds = CType(Dts.Variables("VP_EMAIL_RESULTS_RS").Value, DataSet)



My intent is to email the query results to each email address with the following type of data by passing the parsed data from the script to a send mail task. Email works fine and sends out messages but the content is empty. I pass the parsed data as string values to the messagesource and define the messagesourcetype as a variable in the mail task.



part number leadtime

x 5

y 9

....



Does anyone have any idea what I might be doing wrong?

thanks

John

View 5 Replies View Related

Adding The Data Flow Task Programmatically

Aug 1, 2007

Is it possible to add a Fuzzy Grouping Transformation in a Data flow task by Programmatically ? If it possible, what is the C# or VB .net code for that ?

View 1 Replies View Related

Programmatically Modifying An Execute SQL Task In A Package

Mar 24, 2008



I am making some changes to a tracking SP that I'm using in about 100 SSIS packages. I don't want to go into each package and add the additional parameter (A "?") and map a variable to some ordinal position. I'd like to do this programmatically.

I have some expirence in validing variables and manipulating connection objects in packages though a utility that I wrote. However, I cannot find any guidance on How to create/edit Execute SQL Tasks via code in the package. I would like to do something like this..





Code Snippet
private Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application();
Package p = app.LoadPackage(DTSPackage, null);
p.Executables["My Execute SQL Task"]






However, the Executables returns an Executable object that is a DtsObject. Do I have to add a reference to the task and cast this executable to that type? Any help is appreciated.

Thanks
Scott

View 4 Replies View Related

Using Disable Property For Data Flow Task Dynamically ?

Mar 18, 2008

hello guys,

I am having trouble with using disable property in the expression for data flow task. Here is the issue as explained below-

lets say i have 3 tables TableA, TableB, TableC from which i need to export data. So i create a table (TableList) where I save these table names and a unique id to these tables. e.g.

TableList will have-
TableName TableID
TableA 1
TableB 2
TableC 3


in the ssis package select these tableNames & Ids from tableList in Execute SQL Task. And assign the result set to a variable object (@TableList.

Then i use For Each Loop Container (For Each ADO Enumerator) , to loop through these tablesnames & iDs

Inside this loop container, i define three data flow tasks one for each table. So i have DataFlowTaskA (For TableA), DataFlowTaskB(For TableB), DataFlowTaskC (For TableC).

Now for a given table selected in the iteration, only the corresponding DataFlow Task should be exeuted. e.g. For the 1st iteration, if TableA is selected then only DataFlowTaskA should be executed and DataFlowTaskB& C should be skipped.

In order to achieve this, I am using a 3 variable @FlagA, @FlagB, @FlagC (type Boolean) one for each Table. and use the value of these flags for the "Disable" property of the data flow task (so @FlagA will be used for Disable property in the Expression for Data FlowTaskA, and so on..)

SotThe First Step inside the Loop, I use Script Task. (Input for the script task: read variable is @TableID and Read/Write varaibles are these 3 flags)

In this script task, I initialize these flags to true or false appropriately. So this is what i do


If (Dts.Variables("TableID").Value.ToString = "1") Then
Dts.Variables("@FlagA").Value = False
Else
Dts.Variables("@FlagA").Value = True

End If


If (Dts.Variables("TableID").Value.ToString = "2") Then
Dts.Variables("@FlagB").Value = False
Else
Dts.Variables("@FlagB").Value = True

End If


So in the 1st iteration, (if TableA comes) @FlagA=False and B&C will be True.
So the Disable property for DataFlowTask will be set false and for others it will be set to True. Thus, only DataFlowTaskA will be executed.

And this action should be repeated for each input table. this is the logic.



However only for the 1st iteration(say TableA is selected) it behaves as above. i.e. DataFlowTaskA is executed and DataFlowTaskB & C are skipped. But in the 2nd iteration(say TableB is selected) , it again executes DataFlowTaskA and doesnt exeute B & C (where it should have executed B & skipped A&C).

I do set daelay validation to true for all these but it still it doesnt working as expected. Even I checked the values for all the flags for each iteration and they seem to get the correct values. But somehow Diable propery in the expression not behaving as it should.

Am i missing anything. Do i need to set any other property to make this work.


I apprecite any help.

Thanks

View 3 Replies View Related

How To Programmatically Detect The Failed Task After Executing The Package

Apr 27, 2007

SSIS Experts,

I am executing a child package programmatically and want few lines of code to detect cause of the failure on the fly. One way will be to run the child package through dtexec command uility. But on the fly i will be assigning few values in Parent package variable to the child variables and finally run the child package. Since we cannot apply expressions or use precendence constraints in place, It seems that we are left with only choice to programmatically detect errors in tasks. In DTS, it was achieved this way:






Code Snippet

For Each ostep In oPkg

If ostep.ExecutionResult = DTSStepExecResult_Failure Then

ProcessSubDTSPackage = DTSTaskExecResult_Failure

End If

Next





Thanks

Subhash Subramanyam

View 4 Replies View Related

Programmatically Adding A Script Component To Data Flow Task

Feb 2, 2007



Dear all,

I am developing tools for automatic creation of data warehouse tables, cubes and SSIS packages. Generating the SSIS Data Flows works very well using the SSIS components for OLE DB Source, Derived Column, Lookup and OLE DB Destination.

However for some of the advanced functionality I need to use Script Component. I have managed to add it in the Data Flow with all inputs and outputs, but how do I populate it with my code? I've seen there is a component property called "SourceCode" and one called "BinaryCode". The "SourceCode" contains the code, but also some extra metadata.

Questions:

Do you know if there is any programmatic support to generate the Source Code property with the metadata necessary?

Do you know how to compile the Source Code and generate the property BinaryCode?

Example from my code below:

// Create script component

IDTSComponentMetaData90 script = dataFlowTask.ComponentMetaDataCollection.New();

script.ComponentClassID = app.PipelineComponentInfos["Script Component"].CreationName;

CManagedComponentWrapper scriptWrapper = script.Instantiate();

script.InputCollection.New();

script.OutputCollection.New();

scriptWrapper.ProvideComponentProperties();

script.Name = "Logics";

// Create path

IDTSPath90 scriptPath = dataFlowTask.PathCollection.New();

scriptPath.AttachPathAndPropagateNotifications(lastComponent.OutputCollection[0], script.InputCollection[0]);

// Populate input and output columns

IDTSInput90 scriptInput = script.InputCollection[0];

IDTSVirtualInput90 scriptVInput = scriptInput.GetVirtualInput();

foreach (IDTSOutputColumn90 col in oledbSrc.OutputCollection[0].OutputColumnCollection)

{

scriptWrapper.SetUsageType(scriptInput.ID, scriptVInput, col.LineageID, DTSUsageType.UT_READONLY);

IDTSOutputColumn90 tmp = script.OutputCollection[0].OutputColumnCollection.New();

tmp.Name = col.Name;

tmp.SetDataTypeProperties(col.DataType, col.Length, col.Precision, col.Scale, col.CodePage);

}

// Make script asynchronous

script.OutputCollection[0].SynchronousInputID = 0;

Thanks for any assistance and Best Regards,

Johan Åhlén,
Business Intelligence consultant at IFS

View 2 Replies View Related

How To Programmatically Set Column Mappings Of A Simple Data Flow Task?

Sep 4, 2007

Has anyone done this? I can't find anything in the documentation
that describes this. The closest I get is to the InnerObject property
of the TaskHost class. There is an example of programming a bulk
insert task. But I can't find anything on programmatically setting
the column mappings (source to dest) of a simple data flow task. Any
help is appreciated!

View 7 Replies View Related

How To Enable And Disable The Identity

Nov 17, 2006

Hello there :-)

Kindly help me find the answer on how to enable and disable the identity of a field on a table via SQL Script?

Thanks :-)

View 1 Replies View Related

Enable And Disable Websync.log

Jan 9, 2007

Hi, is there a way how to enable / disable logging on web merge synchronization into the file websync.log? The file exists in the ISAPI folder, on some machines there are some messages, on others there is nothing. There are Timeout messages on the client during synchronization and we need to find where is the problem, if it is on the server side or if it is a network error or something else.
Thanks, Pavel

View 8 Replies View Related

URGENT: Disable And Enable The Constraints

Dec 12, 2000

Hi everybody,

Is there any procedure or option to disable and enable constraints on database.the problem is we are having lot master and child tables. when i am trying to move the entire data from original db to another same db, there i am getting constraints problem. child tables are not accepting data with out loading the master tables.

is there any to disable and enable constraints? please give me reply asap


Thanks in advance
Giri

View 3 Replies View Related

Enable And Disable Case Sensitivity

Feb 20, 2004

Hi,

I use a SQL Server 2000.

Is there a chance to change the case sensitivity option for a running instance of sql server?

I know, during the install process, i can activate the case sensitivity. But can I change this option on an already installed server (to case sensitiv or back)?

Thanks

View 4 Replies View Related

SQL 2012 :: Enable / Disable AG Listener

Jul 3, 2014

How can one enabledisable Availability Group listener? I know AG listener can be deleted and added but didnt find anything to disable or enable that.

View 1 Replies View Related

SQL 2012 :: Disable And Enable Trigger?

May 25, 2015

I have a trigger that I disable so I can do some operations on a table.

After the operations are completed I do the enable using the enable trigger comand.

Do I need to do something else to put back the trigger working as it was before the disable comand?

View 3 Replies View Related

Enable/disable Logging Dynamically

May 11, 2007

Is there a way to turn on/off a given logger dynamically across the board, and still enable the logging of task specific events, like "ExecuteSQLExecutingQuery" from the ExecuteSQL task or "WMIDataReaderOperation" from the WMI Data Reader task?

The use case is one where multiple loggers are defined in a package (custom and stock) and I'd like to toggle the execution tracing on a per logger basis.

I realize "logger toggling" can be done programmatically, but I'm wondering if that's the only way to accomplish the objective.

View 3 Replies View Related

Parameters Binding Enable/disable

Sep 19, 2007

Hello,

I am a beginner in SQL Server Reporting Services.
My report has three parameters; all with the same characteristics (combobox (multiple values, datatype: String, Available values: from query, default value:null).

When i am in the Preview Tab of the Report, the combo box of the first parameter is enabled, the combo box of the second parameter is disabled.

Once i select a value for the first parameter, the combo box of the second parameter becomes enabled.

I would like to select a value for the the second parameter in spite i did not select a value for the first parameter.
I do not find a solution in the properties of the parameters.

How can I do it ?
Thanks and sorry for my english

View 1 Replies View Related

Enable/Disable Constrains In Schema

May 29, 2008



Hello, is possible Enable or disable constrains in a defined schema? or Alter constrains in a defined schema.

For example in schema1 for user1 the constrains definitions are enabled.

There are another schema called schema2 for user2 and constrains definitions are disabled.

Thanks.

View 1 Replies View Related

Trigger On Enable / Disable SQL User

Mar 31, 2006

Is it possible to run a trigger whenever a SQL user is disabled or enabled? From what I've seen of various sysusers and syslogins tables there isn't a column that represents enabled or disabled.

View 6 Replies View Related

Enable/Disable SQL Server Login

Oct 13, 2005

Hi,

View 4 Replies View Related

How To Disable/enable An Identity Column In A Table

Jan 3, 2002

hi folks,
How to disable/enable an Identity Column in a table with the help of an sql
statement.
Thanks in advance.
Vineet Agarwal

View 1 Replies View Related

Disable/Enable A Trigger On A Replicated Table.

Apr 9, 2002

I have transaction replication setup on two SQL7 boxes and a nightly job runs a procedure that need to alter a table and disable a trigger. Since replication has been set up the disable doesn't work. Any way around this.

View 2 Replies View Related

SQL Server 2008 :: Enable And Disable Trigger

Oct 25, 2015

the disable trigger will be enable again.Because I already disable the trigger on last month, but when I check through the database, it enable again.I understand that, when we restore the database, all the trigger will be enable.How about SQL Cluster? will it enable the trigger??

View 3 Replies View Related

Reporting Services :: Enable And Disable Checkbox?

Sep 16, 2015

How can we create a checkbox in SSRS and how can it be enabled disabled based on the value.

View 5 Replies View Related

How To Disable/enable Jobs For Database That Has Failed Over

Nov 22, 2006

Hi,

I currently have serverA importing data from an AS400 oledb connection and serverB on hot-standby as a mirror. The data import is being performed via an SSIS scheduled job.

I've yet to implement any solution in the following case:
If the database on serverA fails, it will failover to the mirror. But the jobs will still be on serverA. Ideally, I'm assuming the jobs should not run on serverB since it will be attempting to update the mirrored database. So, I am wondering if both servers can have identical copies of SSIS packages and jobs and simply (?) enable or disable them based on which server will be hosting the principal database.

Is there any solution where the jobs can automatically be disabled on the server with the mirrored database and enabled on the principal database depending on its status?

View 4 Replies View Related

Enable And Disable User In MsSql 2000 Database

May 25, 2007

Hi,




I'm using MsSql 2000 data base, how to enable and disable user in mssql 2000 version

View 3 Replies View Related

Is It Possible To Decide Whether To Enable/disable Interactive Sort At Runtime?

Jun 26, 2007

I have a parameter for each field that lets me know if a field can be sorted or not.
What I want to be able to do is turn on or off interactive sorting for that column based on that parameters value.

In the dialog you have a check box that says enable interactive sorting. When that is clicked it appears that you get the two arrows no matter what you put in the expression.

I have tried

=IIF(allowSorting,Fields!myColumn.Value,"")

and

=IIF(allowSorting,Fields!myColumn.Value,Nothing)

but both result in the arrows still being there, just the sort doesn't work.

Is it possible to put an expression on the sort arrows appearing at all?

View 3 Replies View Related

Want To Enable/disable Report Builder Option For Set Of Users

Feb 8, 2008


I want to restrict report builder access only to a reporting alias and block for other users.
Please suggest the solution

View 3 Replies View Related

Enable/disable Extende Stored Procedure In MSSQL2005

Sep 20, 2007



Hi,

Anybody now how to this programmaticly ? in registry or TSQL statement ?

View 3 Replies View Related

Integration Services :: Stored Procedure In Execute Task Fails But Task Does Not Fail

Jul 1, 2015

I'm using SSIS in Visual Studio 2012. My Execute SQL Task calls a Stored Procedure where I have a TRY-CATCH. Last week there was a problem and the CATCH was executed and logged an error to my error table, but for some reason the Execute SQL Task didn't fail. Is there a setting to make the Execute SQL Task fail when an SP encounters a failure?

View 3 Replies View Related

Error: The Task With The Name Data Flow Task And The Creation Name DTS.Pipeline.1 Is Not Registered For Use On This Computer

May 4, 2006



Hi,

I am trying to create a simple BI Application for SSIS. In Visual Studio 2005 I just get a Data Flow Task from the toolbar and add it to the project. When I double click it I get the following error:

The task with the name "Data Flow Task" and the creation name "DTS.Pipeline.1" is not registered for use on this computer.

Then when I try to delete it it gives this other error:

Cannot remove the specified item because it was not found in the specified Collection.

I am creating this application in an administrator account in this computer, so I doubt the problem is related to permissions. I am running SQL Server 2005 and Visual Studio 2005 in WinXP Tablet PC Edition.

Any suggestions why this is happening and how to fix it?

View 17 Replies View Related

SSIS Task Transfer SQL Server Objects Task And Default Constraints On Tables

Feb 21, 2008



I am using the "Transfer SQL Server Objects Task" to copy some tables from database A to database B including data.

The tables, primary key constraints, Foreign key, data and all transfers nicely except for "DEFAULT CONSTRAINTS" on the tables.

I have failed to find any option in the "Transfer SQL Server Objects Task" task to explicitly say "copy default constraints". So I guess logically it should happen automatically but it doesn't. I hope it is not a bug :-)

Any option anyone knows will help.

Thanks.

View 17 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved