Multiple SQL task objects inside a package object is not generating proper DTSX


I am programmatically adding multiple ExecuteSQLtask objects inside a package. I am specifying all the required properties to the ExecuteSQLtask objects.  However, when I save the package object to dtsx, the package looses the properties of some
of the ExecuteSQLtask object.
In the below example, I have created 3 ExecuteSQL task objects using the function AddSqlTask. However, once you run it, one of the objects will loose its properties. What makes it more weird is the fact that sometimes, object 1 looses the properties,
some times, its object number 2. Its random. I know that these objects are COM objects. Is there something I need to careful of when setting the properties ? Why are the values lost when I save them to DTSX ?
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Timers;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask;
using Microsoft.SqlServer.Dts.Tasks.ExecutePackageTask;
namespace PackageCreator
class Program
static void Main(string[] args)
#region Package 1
Package package1 = new Package();
#region ConnectionString
AddSqlConnection(
package1,
ConfigurationManager.AppSettings["ServerHostName"],
ConfigurationManager.AppSettings["SqlServerDefaultDB"]
#endregion
AddSqlTask(package1, "P1 - Task1");
AddSqlTask(package1, "P1 - Task2");
AddSqlTask(package1, "P1 - TaskFinal");
#region Add Dependencies
package1.PrecedenceConstraints.Add(
package1.Executables[0] as TaskHost,
package1.Executables[1] as TaskHost
package1.PrecedenceConstraints.Add(
package1.Executables[1] as TaskHost,
package1.Executables[2] as TaskHost
#endregion
#endregion
#region Package 2
Package package2 = new Package();
#region ConnectionString
AddSqlConnection(
package2,
ConfigurationManager.AppSettings["ServerHostName"],
ConfigurationManager.AppSettings["SqlServerDefaultDB"]
#endregion
AddSqlTask(package2, "P2 - TaskFinal");
#region ExecutePackageTaskClass
Executable exec1 = package2.Executables.Add("STOCK:ExecutePackageTask");
TaskHost th = exec1 as TaskHost;
ExecutePackageTask myTask = th.InnerObject as ExecutePackageTask;
myTask.PackageID = package1.ID;
#endregion
#region Add Dependencies
package2.PrecedenceConstraints.Add(
package2.Executables[0] as TaskHost,
package2.Executables[1] as TaskHost
#endregion
#endregion
//new Ispac(package1, package1.ID).DeployAndRun();
SavePackage(package1);
SavePackage(package2);
var packageList = new List<Package>();
packageList.Add(package1);
packageList.Add(package2);
new IspacPackageCollections(packageList).DeployAndRun();
Console.Read();
private static void AddSqlTask(Package package, string component)
//Thread.Sleep(5000);
package.Executables.Add("STOCK:SQLTask");
ExecuteSQLTask executeSQLTask = (package.Executables[package.Executables.Count - 1]
as TaskHost).InnerObject
as ExecuteSQLTask;
executeSQLTask.Connection = package.Connections[0].ID;
executeSQLTask.SqlStatementSource = "insert into [dbo].[SupersetPackageDependencies] (Component) values ('" +
component + @"')";
private static void SavePackage(Package package)
string packageNetworkLocation = @""
+ ConfigurationManager.AppSettings["packageNetworkLocation"]
+ @"\" + package.ID + ".dtsx";
new Application().SaveToXml(
packageNetworkLocation,
package,
null
//new Application().SaveToSqlServer(
// package,
// null,
// "ANUPN8470P",
// null,
// null
#region AddConnectionManager
private static ConnectionManager AddSqlConnection(Package package, string server, string database)
return AddConnection(
package,
"OLEDB",
String.Format(
CultureInfo.InvariantCulture,
"Provider=SQLOLEDB.1;Data Source={0};Persist Security Info=False;Initial Catalog={1};Integrated Security=SSPI;",
server,
database)
private static ConnectionManager AddConnection(Package package, string type, string connectionString)
ConnectionManager manager = package.Connections.Add(type);
manager.ConnectionString = connectionString;
manager.Name = String.Format(
CultureInfo.InvariantCulture,
"{0} Connection",
type);
return manager;
#endregion
public static void AddExecuteSqlTask(
Package _package,
string _componentId
_package.Executables.Add("STOCK:SQLTask");
// Get the task host wrapper
ExecuteSQLTask executeSQLTask = (_package.Executables[_package.Executables.Count - 1]
as TaskHost).InnerObject
as ExecuteSQLTask;
#region Set required properties
executeSQLTask.Connection = _package.Connections[0].ID;
executeSQLTask.SqlStatementSource = "insert into [dbo].[SupersetPackageDependencies] (Component) values ('" +
_componentId + @"')";
#endregion
//return executeSQLTask;

Why you do not tell what properties get lost?
And why is the same get repeated (you want parallel?):
package1.Executables[0] as TaskHost,
package1.Executables[1] as TaskHost
package1.PrecedenceConstraints.Add(
package1.Executables[1] as TaskHost,
package1.Executables[1]
And why not to add them
like
package1.PrecedenceConstraints.Add(
package1.Executables[0] as TaskHost);,
package1.PrecedenceConstraints.Add( package1.Executables[1] as TaskHost
Arthur
MyBlog
Twitter

Similar Messages

  • Vector Smart Object inside another smart object losing quality after scale

    Hi,
    I have 6 icons created on Illustrator and imported as vector smart objects.
    Then, I select all 6 and create another Smart Object from then.
    If I scale this smart object now, it will loose it´s quality, as if the icons were raster in the first place.
    This was not what happend in in PS CS5.
    It´s a bug or new "feature"?
    Rodrigo C.

    You need to realize that Photoshop renders pixels for the embedded object  then when you scale the smart object layer it scale like and raster layer through interpolation not scaled with vector graphics. Its the way smart object layers work. Hers is a very old thread on the subject
    smart objects pixelized | Adobe Community

  • Find script label on object inside of another object.

    I have a graphic inside of a box the graphic has a script label. I would like to reference it and its parent but.
    var myAsset=myDocument.pageItems.item("Logo"); does not work. I am wondering if using allPageItems might work however, I have not made anything that has worked yet. Like var myAsset=myDocument.allPageItems.PageItem("Logo"); If there are any ideas about this I would appreciate the help.

    Hi Gonterman,
    Can you please try this JS Code.
    This code is select the page Items of "Logo"
    var myDoc = app.activeDocument;
    for (i=0; i<myDoc.spreads.length; i++){
         try{
              myDoc.spreads[i].pageItems.item("Logo").select();
              }catch(e){};
    This code is select the Graphics frome of "Logo"
    var myDoc = app.activeDocument;
    var myGrapic = myDoc.allGraphics;
    for (i=0; i<myGrapic.length; i++){
         var myArt = myGrapic[i];
         try{
              alert(myArt);
              if(myArt.label=="Logo"){
                   app.select(myArt);
              }catch(e){};
    thx
    csm_phil

  • Pacman to show all the files inside a package that is not installed

    Can pacman list out all the files that any packages provides without having that package installed? I learned that pacman -Ql linux does this but the linux packages is installed on my system. Thanks!

    I am trying to use it but it doesn't work right with my options. I want to find any package that gives a directory called "russian" but it isn't finding one I know does called "festvox-ru" as I show you:
    % pkgfile -svid russian
    extra/licq 1.7.1-5 /usr/share/licq/translations/RUSSIAN
    community/gnustep-base 1.24.5-2 /usr/lib/GNUstep/Libraries/gnustep-base/Versions/1.24/Resources/Languages/Russian
    community/lout 3.40-1 /usr/lib/lout/include/russian
    community/nltk-data 2.0-7 /usr/share/nltk_data/corpora/stopwords/russian
    community/rawtherapee 1:4.0.11-1 /usr/share/rawtherapee/languages/Russian
    Here you see the "russian" directory inside my filesystem with that package:
    /usr/share/festival/voices/russian
    Last edited by maggie (2013-09-23 14:34:13)

  • Database Adapter does not generate proper output for PL/SQL table type

    Hi,
    I have a DB Adapter to invoke a stored procedure on Oracle which returns a table type.
    I am getting the following output from the adapter:
    </DB_Test_InputVariable><DB_Test_OutputVariable><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/BPEL_DB_TEST/XXC_KEMET_TEST_PKG-24GETITEMONH/">
    <ITEM_QTY_UOM_OUT>
    <ITEM_QTY_UOM_OUT_ITEM>
    <SERIAL_NUM>1</SERIAL_NUM>
    <ITEM_QTY_OUT>1</ITEM_QTY_OUT>
    <UOM_OUT>BOX</UOM_OUT>
    </ITEM_QTY_UOM_OUT_ITEM>
    <ITEM_QTY_UOM_OUT_ITEM>
    <SERIAL_NUM>2</SERIAL_NUM>
    <ITEM_QTY_OUT>5</ITEM_QTY_OUT>
    <UOM_OUT>BOX</UOM_OUT>
    </ITEM_QTY_UOM_OUT_ITEM>
    </ITEM_QTY_UOM_OUT>
    </db:OutputParameters>
    </part>
    </DB_Test_OutputVariable>
    When I try to transform it, it tries to select /db:OutputParameters/db:ITEM_QTY_UOM_OUT/db:ITEM_QTY_UOM_OUT_ITEM/db:SERIAL_NUM from it and does not give me any output.
    I assume it's the same issue with namespace prefix.
    If anyone has faced a similar issue or knows how to fix this, please let me know.

    I am using a DB adapter to run a stored procedure for a simple Select Query with a table as my out parameter.This creates an XSD when the partner link is created.The elementFormDefault=qualified is by default formed in the xsd.When i change it to unQualified it returns me compilation error.
    Where do i need to change the root element?
    My output of BPEL(P.S. - I have used synchronous BPEL) on the console is
    Your test request was processed synchronously. It took 359.0milliseconds to finish and generated the following output:
    Value: <ProcessResponsehttp://www.w3.org/2001/XMLSchema-instancehttp://www.example.org>
    <null>
    <null>
    <null>database_K_DKL_NW02</null>
    <null>2008-07-07T00:00:00.000+05:30</null>
    <null>2008</null>
    <null>3435</null>
    <null>http://www.google.com</null>
    </null>
    <null>
    <null>database_config.txt</null>
    <null>2006-03-14T00:00:00.000+05:30</null>
    <null>2006</null>
    <null>342345</null>
    <null>\\01hw180464\MOTO\database_config.txt</null>
    </null>
    <null>
    <null>database_help.txt</null>
    <null>2008-07-01T00:00:00.000+05:30</null>
    <null>2008</null>
    <null>68</null>
    <null>\\01hw180464\MOTO\database_help.txt</null>
    </null>
    <null>
    <null>database_search.txt</null>
    <null>2007-12-03T00:00:00.000+05:30</null>
    <null>2007</null>
    <null>365</null>
    <null>\\01hw180464\MOTO\database_search.txt</null>
    </null>
    </null>
    </ProcessResponse>
    whereas the output shown in Invoke in the visual flow is
    <messages>
    -<Invoke_1_Callin_Db_InputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    -<InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/VODAT/BPEL_CALLIN_DB/MOTOROLA_BSC_DB-24VIEW_MOTOROLA/">
    <IN_FILENAME/>
    </InputParameters>
    </part>
    </Invoke_1_Callin_Db_InputVariable>
    -<Invoke_1_Callin_Db_OutputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    -<db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/VODAT/BPEL_CALLIN_DB/MOTOROLA_BSC_DB-24VIEW_MOTOROLA/">
    -<MYCURSOR>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_K_DKL_NW02
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-07T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>3435
    </FILE_SIZE>
    <FILE_PATH>http://www.google.com
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_config.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2006-03-14T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2006
    </CREATION_TIME>
    <FILE_SIZE>342345
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_config.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_help.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-01T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>68
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_help.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_search.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2007-12-03T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2007
    </CREATION_TIME>
    <FILE_SIZE>365
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_search.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    </MYCURSOR>
    </db:OutputParameters>
    </part>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]
    </part>
    </Invoke_1_Callin_Db_OutputVariable>
    </messages>
    and the output shown in ReplyOutput is :-
    <outputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    -<ProcessResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.example.org">
    -<MYCURSOR xmlns="">
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_K_DKL_NW02
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-07T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>3435
    </FILE_SIZE>
    <FILE_PATH>http://www.google.com
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_config.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2006-03-14T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2006
    </CREATION_TIME>
    <FILE_SIZE>342345
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_config.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_help.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-01T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>68
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_help.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_search.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2007-12-03T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2007
    </CREATION_TIME>
    <FILE_SIZE>365
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_search.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    </MYCURSOR>
    </ProcessResponse>
    </part>
    </outputVariable>
    Can you please tell me why am i getiing null value in my output xml in my BPEL console??
    What is the solution?where do i need to change the db: prefix?

  • How to run multiple sqls in one jasper report

    Hello!
    Is there any one that can help me in integrating/ viewing my xml file to the web. I have my GUI in jsp format, the jsp makes a call to the bean class and then finally bean class hit my reports java class.The report java class generates the report and shows it in the new window.
    The problem is with writing mutiple sql queries and showing the result from multiple sql queires in one report.
    I do not know how to write multiple queries for just 1 report. I can give a simple example of my problem also.
    My report is as follows:
    First Name Middle Name Last name
    Sandeep               Pathak
    Now First and Middle Name come from 1st sql query and Last Name comes from 2nd sql query.
    I want to join the result obtained from both the sql queries in one Jasper Report (not as 2 separate sections but as one section).
    My problem is how to view my report in the web. furthermore, how to make complex query in jasperassistant, like multiple table in one query, because i�m integrating multiple query in one form or sheets of paper.
    Please help me in this.
    Thanks
    Sandeep
    Calance
    India

    Hi Sheldon,
    we never have issues when we combine standard objects, like a cliear with a load inforprovider, or the master data integration you mentioned in your document. However, from the moment we combine a script logic with a standard package (like a move) it does not work .The data package contains the task needed for the script and for the move. the process chain is called up but always comes in error in the first step (BPC modify dynamically ) ... there is also no log when checking the view status ...
    I can sent you some screenshots if you like ...
    D

  • SSIS Execute SQL Task using sp_rename giving deadlock issues

    All,
    We have a job that has 2 steps and both of those steps call an SSIS package
    1st package - Loads the data from a SQL server source, to a SQL Server destination tables, say, "TblHistory" is one of them
    2nd package - It does a re-name from the History table to the Main table, so below, is how the code looks like in the execute SQL Task:
    BEGIN TRANSACTION
    EXECUTE sp_rename 'dbo.Tbl', 'TblOld'
    EXECUTE sp_rename N'dbo.TblOld.PK_TblId', N'PK_TblIdOld', N'INDEX'
    EXECUTE sp_rename 'dbo.TblHistory', 'Tbl'
    EXECUTE sp_rename N'dbo.Tbl.PK_TblHistoryId', N'PK_TblId', N'INDEX'
    EXECUTE sp_rename 'dbo.TblOld', 'TblHistory'
    EXECUTE sp_rename N'dbo.TblHistory.PK_TblIdOld', N'PK_TblHistoryId', N'INDEX'
    COMMIT TRANSACTION
    In package 1 there are multiple history tables that are being loaded and most of them get renamed in the 2nd package. There is a separate SQL task for each of the history tables. The problem that I am running in to are the deadlock issues. When the 2nd package
    runs, it throws this error:
    "SQL - Table Rename & Swap for "Tbl" Execute SQL Task     Description: Executing the query "BEGIN TRANSACTION     EXECUTE sp_rename Tbl..." failed with the following error: "Transaction
    (Process ID 60) was deadlocked on lock resources with another process and has been chosen as the deadlock victim."
    It's giving me a deadlock issue on the other tasks as well. So, when the job ran today, I am noticing 4 deadlock errors on the 4 different execute SQL tasks in the 2nd package (i.e. the job fails at 2nd step)
    Has anyone faced this scenario before?

    Why renaming tables? The data do not change. So just load the data to an interim table and push it to the target or may be you do not need it at all - just load the right table.
    I admit I fail to capture the overall picture of what you are trying to solve or deliver. But renaming tables is something not usual.
    Arthur My Blog

  • Declare object type inside the package

    Hi,
    How can I declare an object type inside the package?
    CREATE TYPE TempObj AS OBJECT (
    user_id number,
    text varchar2(4000),
    date_created DATE
    This will not work if placed inside this:
    CREATE OR REPLACE PACKAGE SAMPLE_PKG IS
    ---declaration goes here.
    END SAMPLE_PKG;
    I tried using the type RECORD and it worked. But I am just curious how to declare an Object. Or maybe RECORD is the replacement of Object? is this correct?
    thanks,
    Baldwin

    The inside of a PL/SQL package should contain PL/SQL statements.
    CREATE TYPE is not a PL/SQL statement. You can't create a table in package either.
    If data protection is the reason that you would rather create the type inside the package, then consider using a record type as you suggested, or hiding the SQL type in a more protected schema.
    Message was edited by:
    jonjac

  • Failed to create an IDataAdapter object. This provider may not be fully supported with the Execute SQL Task

    I executed a simple query inside an execute SQL task - 
    SELECT col1, col2
    from thetable
    where code = ?
    order by id asc
    Exec sql task - ADO.NET connection
    parameter "code" is an int32 in SSIS and int32 in parameter mapping of exec sql task.
    It works fine in SQL server, but in SSIS it causes the error - 
    [Execute SQL Task] Error: Executing the query "SELECT col1, col2
    from thet..." failed with the following error: "Failed to create an IDataAdapter object. This provider may not be fully supported with the Execute SQL Task. Error message 'Incorrect syntax near '?'.'.". Possible failure reasons: Problems with
    the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    How do I fix this error ? 

    Thanks. I think it was sqlclient. I changed it to OLEDB to avoid that issue. Btw, what is this "provider" ?
    Hi blastoSO,
    To check which provider is used by the current ADO.NET Connection Manager, you can open the “Configure ADO.NET Connection Manager” window, and check the “Managed Provider” option of each Data connection.
    In an Execute SQL Task, if the managed provider is “System.Data.SqlClient”, we should use the rule for the ADO.NET connection type in the following table. If the managed provider is “System.Data.Oledb” or “System.Data.Odbc”, it actually uses the OLE DB provider
    or ODBC provider, so we should use the rule for the OLE DB or OBC rule in the following table:
    Reference:
    http://technet.microsoft.com/en-us/library/cc280502.aspx
    Regards,
    Mike Yin
    TechNet Community Support

  • How to Use Sequence Object Inside User-defined Function In SQL Server

    I'm trying to call sequence object inside SQL Server user-defined function. I used 
    Next Value for dbo.mySequence  to call the next value for my sequence created. But I'm getting an error like below.
    "NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables."
    Is there any standard way to call sequence inside a function?
    I would really appreciate your response.
    Thanks!

    The NEXT
    VALUE FOR function cannot be used for User Defined function. It's one of the limitation.
    https://msdn.microsoft.com/en-us/library/ff878370.aspx
    What are you trying to do? Can you give us an example and required output?
    --Prashanth

  • [Forum FAQ] How do I send multiple rows returned by Execute SQL Task as Email content in SQL Server Integration Services?

    Question:
    There is a scenario that users want to send multiple rows returned by Execute SQL Task as Email content to send to someone. With Execute SQL Task, the Full result set is used when the query returns multiple rows, it must map to a variable of the Object data
    type, then the return result is a rowset object, so we cannot directly send the result variable as Email content. Is there a way that we can extract the table row values that are stored in the Object variable as Email content to send to someone?
    Answer:
    To achieve this requirement, we can use a Foreach Loop container to extract the table row values that are stored in the Object variable into package variables, then use a Script Task to write the data stored in packages variables to a variable, and then set
    the variable as MessageSource in the Send Mail Task. 
    Add four variables in the package as below:
    Double-click the Execute SQL Task to open the Execute SQL Task Editor, then change the ResultSet property to “Full result set”. Assuming that the SQL Statement like below:
    SELECT   Category, CntRecords
    FROM         [table_name]
    In the Result Set pane, add a result like below (please note that we must use 0 as the result set name when the result set type is Full result set):
    Drag a Foreach Loop Container connects to the Execute SQL Task. 
    Double-click the Foreach Loop Container to open the Foreach Loop Editor, in the Collection tab, change the Enumerator to Foreach ADO Enumerator, then select User:result as ADO object source variable.
    Click the Variable Mappings pane, add two Variables as below:
    Drag a Script Task within the Foreach Loop Container.
    The C# code that can be used only in SSIS 2008 and above in Script Task as below:
    public void Main()
       // TODO: Add your code here
                Variables varCollection = null;
                string message = string.Empty;
                Dts.VariableDispenser.LockForWrite("User::Message");
                Dts.VariableDispenser.LockForWrite("User::Category");
                Dts.VariableDispenser.LockForWrite("User::CntRecords");     
                Dts.VariableDispenser.GetVariables(ref varCollection);
                //Format the query result with tab delimiters
                message = string.Format("{0}\t{1}\n",
                                            varCollection["User::Category"].Value,
                                            varCollection["User::CntRecords"].Value
               varCollection["User::Message"].Value = varCollection["User::Message"].Value + message;   
               Dts.TaskResult = (int)ScriptResults.Success;
    The VB code that can be used only in SSIS 2005 and above in Script Task as below, please note that in SSIS 2005, we should
    change PrecompileScriptIntoBinaryCode property to False and Run64BitRuntime property to False
    Public Sub Main()
            ' Add your code here
            Dim varCollection As Variables = Nothing
            Dim message As String = String.Empty
            Dts.VariableDispenser.LockForWrite("User::Message")
            Dts.VariableDispenser.LockForWrite("User::Category")
            Dts.VariableDispenser.LockForWrite("User::CntRecords")
            Dts.VariableDispenser.GetVariables(varCollection)
            'Format the query result with tab delimiters
            message = String.Format("{0}" & vbTab & "{1}" & vbLf, varCollection("User::Category").Value, varCollection("User::CntRecords").Value)
            varCollection("User::Message").Value = DirectCast(varCollection("User::Message").Value,String) + message
            Dts.TaskResult = ScriptResults.Success
    End Sub
    Drag Send Mail Task to Control Flow pane and connect it to Foreach Loop Container.
    Double-click the Send Mail Task to specify the appropriate settings, then in the Expressions tab, use the Message variable as the MessageSource Property as below:
    The final design surface like below:
    References:
    Result Sets in the Execute SQL Task
    Applies to:
    Integration Services 2005
    Integration Services 2008
    Integration Services 2008 R2
    Integration Services 2012
    Integration Services 2014
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • SSIS Package Load Failure and is missing Execute SQL Task in Toolbox

    Also, BIDS closes after right-clicking the toolbox and selecting “Choose Items”.
    I’ve tried several ways to fix these issues with no success.
    I’m running SSIS/SSMS/SQL Server 2008 R2 (but not running an SQL instance on my PC) on a Windows XP with Service Pack 3 workstation. I get the following errors:
    WHEN OPENING BIDS:
    I get 2 errors titled “Package Load Failure”. They both reference ‘Visual Studio Explorers and Designers Package’ as being what failed to load. The first message references GUID 8D8529D3-625D-4496-8354-3DAD630ECC1B. The second references GUID AA612177-A69A-4391-B2F4-17F8A88F4BBA
    . They both mention contacting the package vendor, but I haven’t got any Add-ins loaded so I’m not sure what that means exactly. They also both ask if I’d like to skip loading the package in the future.
    ONCE BIDS IS OPEN:
    No error messages appear here. There is no ‘Execute SQL Task’ in the toolbox for Control Flows. Also, if I attempt to open a project containing this object (Execute SQL Task), I get this error in a modal window:
    TITLE: Microsoft Visual Studio
    There were errors while the package was being loaded.
    The package might be corrupted.
    See the Error List for details.
    BUTTONS:
    OK
    . . . and these errors in the Error List at the bottom of the IDE:
    Error      1             
    Error loading Package.dtsx: Failed to load task "Execute SQL Task", type "Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ExecuteSQLTask, Microsoft.SqlServer.SQLTask, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91". The contact information
    for this task is "Execute SQL Task; Microsoft Corporation; Microsoft SQL Server 2008 R2; © 2007 Microsoft Corporation; All Rights Reserved;http://www.microsoft.com/sql/support/default.asp;1". 
            C:\Documents and Settings\848862.VCHS_NT_DOMAIN\My Documents\Visual Studio 2008\Projects\LearnSSIS\LearnSSIS\Package.dtsx   
    1               
    1             
    Error      2             
    Validation error. Execute SQL Task : The task has failed to load. The contact information for this task is "Execute SQL Task; Microsoft Corporation; Microsoft SQL Server 2008 R2; © 2007 Microsoft Corporation; All Rights Reserved;http://www.microsoft.com/sql/support/default.asp;1". 
            Package.dtsx    
    0             
    0             
    Error      3             
    Validation error. Execute SQL Task : There were errors during task validation. 
       Package.dtsx    
    0             
    0               
    Finally, when I attempt to add the Execute SQL Task via the Tools menu, “Choose Toolbox Items” selection, I do get the tabbed box for adding things. However, they only come up after issuing this error:
    The following assemblies are installed SDK assemblies but could not be shown in the customize toolbox dialog because they are missing one or more components. Please make sure that all necessary libraries are available:
    Microsoft.SqlServer.SqlCEDest.dll
    Microsoft.SqlServer.Management.CollectorTasks.dll
    Microsoft.SqlServer.SQLTask.dll
    System.Data.SqlServerCe.dll
    Microsoft.Synchronization.Data.SqlServerCe.dll
    (above dll repeated at bottom of message)
    After this message, I have my choice of .NET Framework Compnents. When I select COM Components, those come up with no problem. The WPF Components tab generates the same dll error above. The Maintenance tab is empty. The SSIS Data Flow Items tab loads fine,
    as does the SSIS Control Flow Items tab – but there’s no Execute SQL Task there either.
    If you open the toolbox (on a new project, with a project loaded, or without a project loaded) and right-click, then select “Choose Items”, the entire application quickly closes. This “closing behavior” is the same thing you get if you attempt to add toolbox
    items through either the Tools menu or the right-click method when you launch BIDS in SafeMode.
    In an effort to fix this – I’ve rolled back the .NET Framework version to 3.0 and reinstalled back up to 4; I’ve uninstalled and reinstalled SQL Server 2008 R2 shared services as well as the entire application; I’ve cleared the .tbd files from my user profile;
    and I’ve run several things from the command line (devenv.exe /resetuserdata, /setup, /resetskippkgs, etc.). Lastly – I’ve applied every Service Pack and update applicable to my PC (ok, it belongs to my employer – but no one here has been able to figure this
    out either).
    After having worked this for several days now and, I think, exhausting every available avenue from search engines – I turn to you. Please let me know if you can help. Also, I can provide any additional
    files or information you may require.
    CBS

    try: Devenv.exe /ResetSettings
    http://msdn.microsoft.com/en-us/library/ms241273(v=vs.80).aspx
    Or try this (it's for 2005, but maybe it works for 2008 aswell):
    http://geekswithblogs.net/cicorias/archive/2007/10/10/Restoring-Missing-Toolbox-Items-in-Visual-Studio-2005---just.aspx
    or try
    http://stackoverflow.com/questions/1268298/how-to-rebuild-the-visual-studio-toolbox
    "You can also go into the folder "C:\Documents and Settings\\Local Settings\Application Data\Microsoft\VisualStudio\9.0" and delete the *.tbd files.  I have had to do this a couple times to get rid of duplicate items and when Reset Toolbox crashes
    without warning"
    Please mark the post as answered if it answers your question | My SSIS Blog:
    http://microsoft-ssis.blogspot.com |
    Twitter

  • Execute SQl Task Error SSIS Package

    Hi all,
    I`m using for each loop container in my package to grab the file name from the source path. I have created 2 vairables
    FilePath and SourceFolder
    I`m using execute sql task inside the container and this is my query
    Insert into [dbo].[DCA_FF_TEST] (File_Name,File_Date) SELECT File_name = ?,
    File_Date = GetDate()
    Please not the Table I am trying to insert has more columns but at this stage I dont need them.
    When i execute the task I get an error
    [Execute SQL Task] Error: Executing the query "
    INSERT INTO   [dbo].[DCA_FF_TEST] ([File_Name],[F..." failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters
    not set correctly, or connection not established correctly.
    Can someone point me in the right direction? Am I missing anything?
    Resultset property Set to None
    Parameter Mapping: Variablename: FilePath , Direction: Input, datatype : Varchar, Parametername: 0, ParameterSize: 100.
    I`ve checked the connection as well it works.
    FM

    Did you try
    Insert into  [dbo].[DCA_FF_TEST] (File_Name,File_Date)
    SELECT ?, GetDate()
    Or
    Insert into  [dbo].[DCA_FF_TEST] (File_Name,File_Date) VALUES (?, GetDate())
    A Fan of SSIS, SSRS and SSAS

  • Service objects inside libraries (WAS: Interfaces in Forte -has anyon

    The following message is actually not about interfaces, but libraries:
    > From: Jeanne Hesler <[email protected]>
    > To: [email protected] <[email protected]>
    > Date: Thursday, July 30, 1998 11:12 AM
    > Subject: RE: Interfaces in Forte - has anyone used them?
    >>
    > Just to clarify a few things:
    >>
    1) Just to be 100% correct -- it is actually Libraries that areloaded and
    not Interfaces. The distinction is important because a librarycould
    potentially implement many interfaces (or provide manyimplementations for a
    single interface).
    2) The code in a Library may reference a service object, but itmay not
    define a service object. Of course any SO's referenced by thelibrary
    must already be known to the loading partition. It is OK to havecode like
    this in a library:
    MySO.doSomething();
    The documentation is a little vague on this point, but I haveconfirmed that
    this is true through Tech Support and by experimentation.
    Actually you CAN define and use service objects inside libraries
    (compiled or interpreted) with two restrictions:
    1) You can not define two service objects inside library in different
    projects and call one of them from another. If you need that, both
    service objects must be in the same project.
    2) If service object is defined and used only by library (if it never
    referenced directly by application code), than in order to be able to
    partition application, you will need to create dummy method inside
    application, which will reference this service object (you do not need
    to execute this method - just have in the code).
    WBR,
    Nickolay Sakharov.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    The way stateful Web services are currently handled is through the use of cookies ... once your stub invokes a stateful Web service a cookie is created which routes subseqent requests back to the Web service.
    In your scenario, the problem is given one client has creates Web service 1 and now Web service 2 would like to be able to use that state it really isn't possible unless you engineer a solution yourself ... you would need so somehow set the cookie on your Web service 2 client to that of the original client to Web service 1. State tends to be based around an individual client versus multiple clients for that state.
    There are numerous ways around this but you would be engineering around the issue ... the easiest is to write the state out somewhere so that it can be shared.
    This section of the doc gives a brief overview:
    http://download-west.oracle.com/docs/cd/A97688_06/generic.903/b10004/javaservices.htm
    Lastly be aware there is a bug with timeouts in stateful Web services in Oracle9iAS 9.0.3 that has been fixed in 9.0.4. I can't find the thread here that documents it but when I track it down I will post the link so you can see the workaround.
    Mike.

  • How to include a large amount of objects in a package interface

    Hi guys,
    I would like to include a large amount of objects (programs, classes, etc.) in a package interface in the package builder (SE21).
    I would like to avoid inserting them one by one. Is anyone have a solution? It is not possible to use such characters has " * ". There is no documentation or help provided for this issue.
    Thank you in advance for your answers.
    Best regards,
    Sylvain

    Hello,
    I do not wish to change the package assignment of all my objects.
    I created a new package in which I created an interface to include various objects from others packages (standard and customer specific). I want to make these objects visible into my new package.
    Since I have a high quantity of objects to include in my interface, I would have like to know if there was a simple way to do this task rather than entering the name one by one in SE21.
    I hope the context is clearer now.
    Best regards,
    Sylvain

Maybe you are looking for