[Forum FAQ] How to get SSIS packages XML definition which are stored in SQL Server Integration Services instance

Introduction
Integration Services gives you the ability to import and export packages, and by doing this change the storage format and location of packages. But after import packages into package store, how can we get the package XML definition?
Solution
As we know, SSIS packages are stored in msdb using existing SSIS storage table([msdb].[dbo].[sysssispackages]). The “packagedata” column store the actual SSIS package with Image data type. In order to get the package XML definition, we need to convert “packagedata”
column through Varbinary to XML. You can refer to the following steps:
Using the following query to get package GUID:
SELECT [name],
            [id]
  FROM [msdb].[dbo].[sysssispackages]
Using the following query to convert packagedata column to XML: SELECT id, CAST(CAST(packagedata AS VARBINARY(MAX)) AS XML) PackageDataXML
FROM      [msdb].[dbo].[sysssispackages]
WHERE id= 'ABB264CC-A082-40D6-AEC4-DBF17FA057B2'
More Information
sysssispackages (Transact-SQL):
http://msdn.microsoft.com/en-us/library/ms181582.aspx
Applies to
SQL Server 2005
SQL Server 2008
SQL Server 2008R2
SQL Server 2012
SQL Server 2014
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

Hi Ketak. Thank you for replying. I already followed your instructions - specifically -
You do not see the SQL Server Reporting Services  service in SharePoint Central Administration after installing SQL Server 2012 SSRS in SharePoint mode
I get the following error when I run rssharepoint.msi on the APP sever (where Central Admin is installed). I have to run this other wise
Install-SPRSService and Install-SPRSServiceProxy 
are not recognized as commands on that server.
Failed to call GetTypes on assembly Microsoft.AnalysisServices.SPAddin, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91. Could not load file or assembly Microsoft.AnalysisServices.SPClient, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. The system cannot find the file specified.
macrel

Similar Messages

  • [Forum FAQ] How do I add an average line to series group on SQL Server Reporting Services column chart?

    Introduction
    In SQL Server Reporting Service (SSRS), you may need an average value on column chart.
    For the above chart, add an average score line to the chart, you can get which student’s score is larger than average score, and which student’s score is less than average score clearly. This document demonstrates how to add an average line to series groups
    on SSRS column chart.
    Solution
    To achieve this requirement, you can add another values to the chart, change the chart type to line chart. Set the value to average value of the series group and set the line to show only once by using expression. Please refer to the link below to see the
    detail steps.
    Click the chart to display the Chart Data pane.
    Add Score field to the Values area.
    Right-click the new inserted Score1 and select Change Chart Type. And then change chart type to line chart in the Select Chart Type window.
    Change the Category Group name to Subject. Here are the screenshot for you reference.
    Right-click the new inserted Score1 and select Series Properties.
    Click the expression button on the right of Value field textbox, type the expression below:
    =Avg(Fields!Score.Value,"Subject"))
    Click Visibility in the left pane, select “Show or hide based on an expression”, and type in the expression below:
    =IIF(Fields!Name.Value="Rancy",FALSE,TRUE)
    Name in the expression is one of the Students. Then only one line chart is be displayed by using this expression.
    Click Legend in the left pane, type Average_Score to the Custom legend text box.
    The report looks like below:
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    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

  • I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    Check this thread where people have already given their suggestion on learning SSIS
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f2cc1cf3-204d-454a-a189-47df87a3aa23/i-want-to-learn-ssis?forum=sqlintegrationservices
    I would suggest to go for You tube videos (type learn SSIS or begin SSIS step by step) you will get lot of good tutorials to start with.
    Happy Learning!!
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • How can i watch purchased tv shows which are stored on the cloud on my laptop?

    how can i watch purchased tv shows which are stored on the cloud on my laptop?

    Hi Miriam1972,
    Thanks for visiting Apple Support Communities.
    You can use iTunes on your laptop to download the tv shows for viewing. See this article for the steps to download the shows:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Best,
    Jeremy

  • [Forum FAQ] How to configure a Data Driven Subscription which get multi-value parameters from one column of a database table?

    Introduction
    In SQL Server Reporting Services, we can define a mapping between the fields that are returned in the query to specific delivery options and to report parameters in a data-driven subscription.
    For a report with a parameter (such as YEAR) that allow multiple values, when creating a data-driven subscription, how can we pass a record like below to show correct data (data for year 2012, 2013 and 2014).
    EmailAddress                             Parameter                      
    Comment
    [email protected]              2012,2013,2014               NULL
    In this article, I will demonstrate how to configure a Data Driven Subscription which get multi-value parameters from one column of a database table
    Workaround
    Generally, if we pass the “Parameter” column to report directly in the step 5 when creating data-driven subscription.
    The value “2012,2013,2014” will be regarded as a single value, Reporting Services will use “2012,2013,2014” to filter data. However, there are no any records that YEAR filed equal to “2012,2013,2014”, and we will get an error when the subscription executed
    on the log. (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles)
    Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportParameterException: Default value or value provided for the report parameter 'Name' is not a valid value.
    This means that there is no such a value on parameter’s available value list, this is an invalid parameter value. If we change the parameter records like below.
    EmailAddress                        Parameter             Comment
    [email protected]         2012                     NULL
    [email protected]         2013                     NULL
    [email protected]         2014                     NULL
    In this case, Reporting Services will generate 3 reports for one data-driven subscription. Each report for only one year which cannot fit the requirement obviously.
    Currently, there is no a solution to solve this issue. The workaround for it is that create two report, one is used for view report for end users, another one is used for create data-driven subscription.
    On the report that used create data-driven subscription, uncheck “Allow multiple values” option for the parameter, do not specify and available values and default values for this parameter. Then change the Filter
    From
    Expression:[ParameterName]
    Operator   :In
    Value         :[@ParameterName]
    To
    Expression:[ParameterName]
    Operator   :In
    Value         :Split(Parameters!ParameterName.Value,",")
    In this case, we can specify a value like "2012,2013,2014" from database to the data-driven subscription.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • SSIS Package Runs OK Manually But Not From SQL Server Agent...Permissions?

    I have a problem where I have an SSIS package (SQL Server 2005) that won't run properly from SQL Server Agent, but it runs fine when kicked off manually from Integration Services -> Run Package or when run in debug from Visual Studio.
    The first step in the package checks for the existance of a file via a script task.  The script looks like this...
    Code Block
    Public Sub Main()
    Dim TaskResult As Integer
    Dim ImportFile As String = CStr(Dts.Variables("BaseDirectory").Value) + CStr(Dts.Variables("ImportDirectory").Value) + CStr(Dts.Variables("ImportFile").Value)
    If Dir(ImportFile) = "" Then
    Dts.TaskResult = Dts.Results.Failure
    Else
    Dts.TaskResult = Dts.Results.Success
    End If
    Return
    End Sub
    This script runs fine and the file is seen as expected when I run the package manually.  But as a step in a SQL Server Agent job, it doesn't see the file.
    The SQL Server Agent service is set to start up / log on as a Local System Account.  I've also tried setting up a credential / proxy (using an account that I know can see and even move / rename the file) to run the job as but that didn't seem to help.
    The package is being run from SQL Server (stored in MSDB) and is set to rely on SQL Server for sensitive information, so I don't think that's an issue; other packages are set up like this in terms of sensitive data and run fine.
    Any ideas why my script can't "see" the file I'm looking at when it's kicked off by SQL Server agent?  I've looked and looked...I can't seem to figure this out.  I would really appreciate any help you might be able to offer up.

    If the variables are fine, then I think it is very likely that this is security related. Since the Agent is running under the local system account, have you verified that the local account can access the file? When you tried the proxy account, are you positive that it was set up properly, and that the account had the permissions to read the file?
    Another thing to check - is this a local file or is on another computer? If it is on another computer, make sure you are using a UNC path and not a mapped drive.

  • How to get the details of Transports which are yet to be imported

    Hi Experts,
    Kindly let me know how to get the Transport request details which were not yet imported.
    For example:
    We have two client in development system 300 and 400, The transports which are created in 300 and imported to 400 (in SCC1).
    I need to know the details of transport requests related to 300 which are yet be to moved to 400.
    Where can i get these details.
    Thanks,
    Narasimhan Krishna

    Narasimhan,
    Take a closer look at Yves KERVADEC's approach. The issue here is that typically SCC1 is used to move transports which have not yet been closed.  You can see the details of any transport via se01/se09/se10, whether open or closed, but my interpretation of your question is that the customer wants to know which transports have been imported into the unit test client (400) via SCC1, which transports have been brought in by the transport system (after they were closed), and which transports have not yet been sent to either the unit test or QA system (i.e. are still open).
    My guess is that you are trying to track down why things work in the unit test client and not in the QA client. That is actually a different question with a different approach, but if that's what you really want to answer, go ahead and ask that question in a separate thread and you'll get a ton of techniques.
    Back to the question you actually asked: By writing a query, you can get a list of transports which have been brought in to the unit test client via SCC1. You can also get this information from SCC1 --> Goto --> Log Display. Then click All Transport Requests and doubleclick on the client. This will give you the import log of your unit test client with date/time stamp. Analysis of that data indicates to me that perhaps you may want to look at CC0_RSCCPROT03_ALV, but I'm not an ABAPer so the previously mentioned tables are probably better.
    Anyway, once you have a list of transports which have been imported, you can subtract out the ones that have been closed and transported downstream (and back into the unit test client.. your transport path does re-import the final version of the transports into the unit test client... right?). You can get that information from another query or you can get the list from STMS as suggested by Aparajit Banik.Then you'll have a list of transports which have been imported into the unit test client via SCC1 but have not yet been released and made it downstream. This will give you a "hit list" of transports which might be causing a mismatch between your unit test and QAS clients. You would then inspect them more closely with SE09/SE10/SE01 (I prefer se01, but different folks prefer different version of the transaction).
    Again, there are better ways to deal with client mismatches, but I'm answering the question you asked in case I misunderstood the underlying subtext.
    I hope this helps!
    Best regards,
    --Tom

  • How can I get INSTID_B for the documents which are stored using Store Business Document functionality

    Dear experts,
    I had activated the functionality of Store Business document and successfully stored documents in external server.
    My client have a custom function module which is used to send emails.In that FM they used SO_DOCUMENT_READ_API1, SO_DOCUMENT_SEND_API1 function modules.They passed Instance Ident(SRGBTBREL->INSTID_B)(eg: FOL33000000000004EXT39000000000026) as export parameter to the FM 'SO_DOCUMENT_READ_API1' and get the attachment details and content.
    Here my problem is I do not have entries in the table SRGBTBREL for the documents which are stored using the Store Business Document functionality and without INSTID_B I am unable to use the FM 'SO_DOCUMENT_READ_API1' to get the document details and content. Please help me to find INSTID_B for documents which are stored using Store Business Document functionality or please let me know if there is any other way to use FM 'SO_DOCUMENT_READ_API1' for documents which are stored using Store Business Document.
    Thanks in advance.
    Regards,
    Kiran

    Hi Kiran,
    You can use the following method to get the information. For example if you want to get BO documents for a customer
    CALL METHOD cl_binary_relation=>read_links
       EXPORTING
         is_object           = ls_lpor
         it_relation_options = lt_relat
       IMPORTING
         et_links            = lt_links.
    then fill  ls_por-instid with a customer number (KUNNR), ls_por-typeid = 'KNA1' and ls_por-catid = 'BO'.
    Table  lt_relat should contain a line option  for each document type (for example 'I' 'EQ' 'NOTE', 'I' EQ 'ATTA', 'I' EQ 'URL', ...
    In table lt_links you will get your information.
    Maybe some other methods of class CL_BINARY_RELATION may also solve your issue.
    Regards,
    Klaus

  • [Forum FAQ] The Reporting Server cannot be reinstalled on a same SQL Server Reporting Service instance

    Symptom: Sometimes, when you want to reinstall the Reporting Server Role for Operation Manager 2012,
    but you may encounter an issue that the Reporting Server Role cannot be reinstalled after you successfully uninstall it. When you check the System Center Operation Manager installation log, you can find the following error as shown in Figure 1.
    Figure 1: Reporting Server Role cannot be reinstalled
    It seems that the SQL Server Reporting Service has not been configured properly. When you open Reporting Services Configuration Manager to check the settings, the settings seem fine though.
    Even you recreate Reporting Service Database, the error remains.
    After reviewing the OpsMgrSetupWizard.log, we get the following errors when wizard try to connect to SQL Server Reporting Instance (Figure 2).
    [07:24:05]:    Error:  :CheckHttpAddressResponse failed: Threw Exception.Type: System.Net.WebException, Exception Error Code: 0x80131509, Exception.Message:
    The remote server returned an error: (500) Internal Server Error.
    [07:24:05]:    Error:  :StackTrace:   at System.Net.HttpWebRequest.GetResponse() at Microsoft.EnterpriseManagement.OperationsManager.Setup.ReportingComponent.CheckHttpResponseFromSRSUrl(String
    httpSite)
    Figure 2: Error Log -1
    It indicates the Reporting Service encounters an internal error. The Website cannot handle the request. So you may check the Reporting Service log which is located in C:\Users\Administrator.SCOM2012\AppData\Local\SCOM\LOGS
    and the following errors may be found (Figure 3).
    library!ReportServer_0-18!1448!03/30/2014-02:53:23:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
    Unable to load assembly Microsoft.EnterpriseManagement.Reporting.Security, Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error.  ---> System.IO.FileNotFoundException:
    Could not load file or assembly 'Microsoft.EnterpriseManagement.Reporting.Security' or one of its dependencies. The system cannot find the file specified.
    File name: 'Microsoft.EnterpriseManagement.Reporting.Security'
    Figure 3: Error Log -2
    Reason: After the Reporting Server is installed on a SSRS instance, the Reporting Server of SCOM
    needs to modify the web.config and rsreportserver.config  file to add its own assembly to make the Reporting Server work. But it does not change it back when Reporting Server is uninstalled. So the assembly cannot be loaded and the SSRS cannot respond
    our requests.
    Resolution:  When the Reporting Server is installed, the old web.config and rsreportsserver.config
    files will be backed up to web.config1 and rsreportsserver.config1. So you just need to change the files’ name back, then try to install Reporting Server of SCOM again. Everything would go smoothly. 
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi AakashGhare,
    According to your error message, SQL Server 2008 databases are version 655. SQL Server 2008 R2 databases are 661. When you are trying to attach an 2008 R2 database (v. 661) to an 2008 instance and this is not supported. As other post, once the database has
    been upgraded to an 2008 R2 version, it cannot be downgraded. You'll have to either upgrade your 2008 SP2 instance to R2, or you have to copy out the data in that database into an 2008 database (such as using the data migration wizard).
    In addition, if you want to use a Windows Batch file code and command to automatically login to SQL Server, detach database and attach a new one database, there is a similar details about batch code for attaching database to a new database, you can refer
    to this article.
    http://notesbyparth.wordpress.com/2012/06/29/run-sql-commands-from-windows-batch-file-or-attachdetach-database-automatically-using-batch-script/
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How to view workflow instance data in redable format which is stored in sql server in blob format

    Hope you are doing well,<o:p></o:p>
    I am praveen kumar i have query regarding microsoft workflow that i have created an workflow application and its working fine. Now i want to see the data which saved
    in database (sql server). when i check i found datakey and value is saved in UserEvent table but the data is saved in BLOB format. but i need to use that data in some sql reporting work. <o:p></o:p>
    what should i do to get that data. as i saved my object like user name, user id, user address . In redable format at database level.<o:p></o:p>
    Waiting for you response.<o:p></o:p>

    Hi praveen4.kumar,
    Welcome to WorkFlow forum.
    From your description above, it's recommended to use the method below.
    By default, the DataReader loads incoming data as a row as soon as an entire row of data is available. Binary large objects (BLOBs) need different treatment, however, because they can contain gigabytes of data that cannot be contained in
    a single row. The Command.ExecuteReader method has an overload that will take a
    CommandBehavior argument to modify the default behavior of the
    DataReader. You can pass SequentialAccess to the
    ExecuteReader method to modify the default behavior of the
    DataReader so that instead of loading rows of data, it will load data sequentially as it is received. This is ideal for loading BLOBs or other large data structures. Further information:
    Retrieving Binary Data
    Please let me know if there is anything that I can do to help.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to hide not all but a specific database on a SQL Server 2008 R2 instance?

    Hello everyone,
          I need help from all the SQL Server database security experts out there. Any solution/help or work-around will be really appreciated. Here is the scenario; our client is using our application which is a windows forms application
    having in backend as a database under SQL Server 2008 R2 instance. We have successfully installed the SQL Server software with mixed mode authentication on client side, our application is running smoothly and everything is working fine. Our database on which
    application is running is quite intuitive, in the sense, all employees information is stored in EmployeeMaster and all departments information is stored in DepartmentMaster and so on. It consists of more than 500 such tables, stored-procedures and views. We
    have encrypted stored-procedures and views, problem is only with tables.
    We don't want table structure to be visible to anybody in SSMS (or tables must be hidden from all the users) but at the same time the tables should be accessible from the application. And we don't want to go with the option of encrypting
    the tables data and changing the names of all the tables to T001,T002..etc. as that is not feasible. And one last thing, we cannot restrict 'sa' login's password, it has to be shared with the client.
    Regards,
    Sumit R. Santani

    Also, will you please enlighten me more on what you said as "couple of choices" if I want to lock out plain users only?
    Assuming that you are selling a solution to a client, it's more an issue for your client's IT department, that do want their users to connect with Excel or SSMS.
    Anyway, I have a brief overview here:
    http://www.sommarskog.se/grantperm.html#Othermethods
    Again my question on that is how much reliable will be that license agreement?
    That depends on the lawyer you engage to write the license agreement.
    How would I come to know what they are doing with our database?
    Trust. Trust is extremely important. It is very difficult to make business if you don't trust people.
    That said, there are basically two reasons you want to hide the application from the client. One is protecting intellectual property. To this end, I know of nothing else than trust. And maybe after all, your application is not so fantastic that it is worth
    stealing anyway.
    The other reason is that you don't want the client to change it, and then open a free support case when he has messed up. To this end there are some technical approaches you can take to detect such tampering. For instance, you can sign all stored procedures
    with certificates using ADD SIGNATURE WITH SIGNED BLOB, and then ship only the public key of the certificate. This permits SQL Server to verify the signature, but the client cannot change the signature and sign it with that certificate, because the private
    key is not available to them.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • [Forum FAQ] How to convert data of date time's type stored in database to display Time Zone based on different territories?

    Introduction:
    There is a date’s type field in the database. When using the field in the report, clients want to convert the field’s values based on own Time Zone to show the date field.
    Workaround:
    Currently, Reporting Services doesn’t provide the function that can get the Time Zone of a client machine. To work around the issue, you need to add a custom code in the report to convert Time Zone and create a parameter through which the client users can
    select his/her Time Zone, and then pass the parameter value to the custom function. Please see the details as follows:
    1. Click the Report, select Report Properties and add the custom code as the screenshot shown:
    Custom code:
    Shared Function FromUTC (ByVal d As Date, ByVal tz As String) As Date
    Return (TimeZoneInfo.ConvertTimeBySystemTimeZoneId(d, TimeZoneInfo.Utc.Id, tz))
    End Function
    2. Create a parameter named TimeZone (you can name the parameter according to your requirement), select Available value and click Specify values.
    Label                                                               
    Value
    China Standard Time                                        
    China Standard Time
    Central European Time Zone                              Central European Time Zone
    India Time Zone                                               
    India Time Zone
    United States of America Time zones                   United States of America Time zones
    3. Call the custom code and type the expression to convert the Time Zone as follows:
    =Code.FromUTC(Fields!UTCDateFromDatabase.Value,Parameters!TimeZone.Value)
    Note: If you use the expression “=Code.FromUTC(Fields!UTCDateFromDatabase.Value,TimeZone.CurrentTimeZone.StandardName)”, it cannot achieve the goal because TimeZone.CurrentTimeZone.StandardName gets the TimeZone of Report Server side rather than Client side.
    More information:
    TimeZone Class
    http://msdn.microsoft.com/en-us/library/system.timezone(v=vs.110).aspx
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012

    Hello,
    Please read the answer provided by Kalman on the following thread:
    http://social.technet.microsoft.com/Forums/es-ES/446df85a-7ad8-4891-8748-478a26350c5c/how-to-compare-tables-in-two-different-servers-while-one-of-the-server-name-has-a-?forum=transactsql
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • [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

  • Why is the LookUp object in the Flow Task of my SSIS package going red (and not working) ? Sql Server 2008 R2

    I have been working with the Sql Server 2008 R2 SSIS Tutorial at
    https://msdn.microsoft.com/en-us/library/ms170419(v=sql.105).aspx
    --specifically -- Lesson 1.  I have been having some problems with this lesson where the source data from the samples download doesn’t exactly match the data described in the tutorial, and the tables in the tutorial are different from what
    is contained in AdventureWorksDW (tutorial refers to DimTime – AdventureWorksDW contains DimDate and no DimTime).  
    So, after futzing in BI with this tutorial  so that I can at least get it to run in Debug – it errors out on the 2<sup>nd</sup> LookUp object.
    Rather than looking for a fix to the problem(s) that I am having between the tutorial and the stuff I downloaded in the samples --
     I want “Adapt” the tutorial so I can use the stuff I downloaded and hopefully learn how to use SSIS with the elements (source data and tables) that are present on my workstation. 
    Here is a description of what is going on for me – which I really don’t understand what is going on in BI – based on the images below – like what columns (from what tables) are they associating to in the OleDB Destination? 
    Note:  the sql in the LookUps here is the sql that I copied from the tutorial. 
    I probably need to modify these sql statements – so -- the help I am requesting is to make the required modifications/changes
     so that I can adapt this tutorial with the stuff that’s on my workstation.
    I downloaded the samples and the AdventureWorksDW mdf for Sql Server 2008 R2. 
    It turns out that in the tutorial it wants me to select a DimTime table, but the version of the AdventureWorksDW db does not contain a DimTime table. 
    Instead, it contains a DimDate table.  So I tried adapting DimDate for the tutorial. 
    Additionally, the sample data file -- SampleCurrencyData.txt -- has slightly different data types than the types described in the tutorial, so I selected data types for the columns in the datasource text file that would work in BI would to
    connect column from source data file to the table.
    After finishing all the steps for Lesson 1 -- when I tried debugging the package – and it error'd out on  the 2<sup>nd</sup> Lookup object whichwent red.
      I edited the lookups and the sample Ole DB Destination to "ignore on fail” and I did all
     green but the FactCurrencyRate table is not being populated -- as described in the tutorial, so I reset the on error back to default (Fail on error option).   And based on this tutorial -- I believe FactCurrencyRate
    table is the table which is supposed to be populated with the data from SampleCurrencyData.txt?
    In the sample data file that downloaded with all the samples  I removed all the data from the text file except for 6 rows, so instead of the original 1100 or so rows, I have only 6 rows of data in the source data file (just to keep things
    simple for debugging for now).  I did not modify the data itself. 
    Here is what the (raw) data contained in SampleCurrencyData.txt looks like (from the samples that I downloaded from codeplex) – it’s supposed to be 4 columns of data – float, nvarchar, datetime, float:
    0.281690141       USD      
    6/26/2004 0:00  0.281713948
    0.281690141       USD      
    6/27/2004 0:00  0.281642539
    0.281690141       USD      
    6/28/2004 0:00  0.281761573
    0.283286119       USD      
    6/29/2004 0:00  0.283221933
    0.283286119       USD      
    6/30/2004 0:00  0.283358363
    0.281690141       USD      
    7/1/2004 0:00     0.281682206
    Below are images of my BI Layout for Lesson 1 from this tutorial -- the FlatFile and configurations for On Fail Error, A Flow task, the 2 LookUps (CurrencyKey and DataKey), the OleDB Destination configuration, the Design view of the associated tables and
    the Debug Run of Lesson 1, and the following error messages. My goal is to figure out what is going on in BI for this tutorial.
    Error: 0xC020901E at Extract Sample Currency Data, Lookup Datakey [51]: Row yielded no match during lookup.
    Error: 0xC0209029 at Extract Sample Currency Data, Lookup Datakey [51]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. 
    The "component "Lookup Datakey" (51)" failed because error code 0xC020901E occurred, and the error row disposition on "output "Lookup Match Output" (53)" specifies failure on error. An error occurred on the specified
    object of the specified component.  There may be error messages posted before this with more information about the failure.
    Error: 0xC0047022 at Extract Sample Currency Data, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. 
    The ProcessInput method on component "Lookup Datakey" (51) failed with error code 0xC0209029 while processing input "Lookup Input" (52). The identified component returned an error from the ProcessInput method. The error is specific
    to the component, but the error is fatal and will cause the Data Flow task to stop running. 
    There may be error messages posted before this with more information about the failure.
    --this is the flat file
     -- SampleCurrencyData.txt (which only contains 6 data rows for my purposes)
    --and here is where I assign the data types for the colums of -- SampleCurrencyData.txt
    This is the first LookUp Object -- LookUp Currency Key – The DB contains DimCurrency table. 
    I copied the sql from the tutorial here.
    I actually have a DimCurrency table in my copy of AdventureWorksDW. 
    Here’s the design view of DimCurrency and a sample of the data contained in DimCurrency and the On Fail configuration
    I actually have a DimCurrency table in my copy of AdventureWorksDW. 
    Here’s the design view of DimCurrency and a sample of the data contained in DimCurrency and the On Fail configuration
    --Here is what the data looks like in the DimCurrency table
    --2<sup>nd</sup> LookUp object  -- LookUp Data Key – this is the LookUp
     where BI errors out on Debug
    --it appears this lookup is referencing the DimDate table – which I DO have in the DB.
    --I can’t find the following sql in the tutorial, so I suppose BI added the sql (did it?)
    --Here's how I configured for On Error
    --Here is DimDate table in Design view
    --Here is a sample of the original data contained in DimData
    OleDB Destination
    --Here is where I get lost a bit – what is going on in the destination here?
    --Here's my On Error configuraino
    --and here is the FactCurrencyRate table
    --and here is a sample of the data contained in FactCurrencyRate
    Rich P

    Thank you for your reply.  I changed the error handling as you suggested on the 2nd lookup to redirect to unmatched rows.  Now I get all greet.  I don't have the conditional split as in your diagram.  But also, nothing appears to have
    happened in the DB.  Aren't the rows in my text file supposed to be added to the FactCurrencyRate table?
    How do I get a conditional split?
    Rich P
    OK, sorry I forgot to reply you back.
    Conditional Split was just dummy task. Ignore it.
    Manipulate the data in such way that you get matching records.
    Inside Source, for first 2 rows I put the dates which are available in DimDate.
    1.00010001,ARS,7/1/2005 0:00,0.99960016
    1.00010001,ARS,2/5/2006 0:00,1.001001001
    1.00020004,ARS,9/5/2001 0:00,0.99990001
    1.00020004,ARS,9/6/2001 0:00,1.00040016
    1.00050025,ARS,9/7/2001 0:00,0.99990001
    1.00050025,ARS,9/8/2001 0:00,1.001001001
    Then in OLE DB Destination, I loaded the rows to TestFactTable.
    (Now, you don't even need NO MATCH OUTPUT as there are matching records here)
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • SSIS Package compiled successful, in SQL Server Integration Service package executed sucessful, But fail to run in MS SQL Job Scheduler

    Hi Everyone,
    I having a problem to transfer data from MS SQL 2005 to IBMAS400. Previously my SSIS was running perfectly but there is some changes I need to be done in order for the system to work well. Considers my changes are minimal & just for upgrades (but I did
    include DELETE statements to truncate AS400 table before I insert fresh data from MS SQL table to the same AS400 table), so I compile my SSIS package & it run successfully & I passed it into MS SQL Integrated Service as 1 of the packages & manually
    executed the package & the result is the same, that mean it was successful again but when I try to run it in a MS SQL Job Scheduler, the job failed with these message shown below as extracted from the job View history. 
    Date today
    Log Job History (MSSQLToAS400)
    Step ID 1
    Server MSSQLServer
    Job Name MSSQLToAS400
    Step Name pumptoAS400
    Duration 00:00:36
    Sql Severity 0
    Sql Message ID 0
    Operator Emailed
    Operator Net sent
    Operator Paged
    Retries Attempted 0
    Message
    Executed as user: MSSQLServer\SYSTEM. ... 9.00.4035.00 for 32-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    
    Started:  today time  
    Error: on today time     
    Code: 0xC0202009     Source: SSISMSSQLToAS400 Connection manager "SourceToDestinationOLEDB"     
    Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. 
    Error code: 0x80004005.  An OLE DB record is available.  
    Source: "IBMDA400 Session"  
    Hresult: 0x80004005  
    Description: "CWBSY0002 - Password for user AS400ADMIN on system AS400SYSTEM is not correct ".  End Error  
    Error: today     
    Code: 0xC020801C     
    Source: Data Flow Task OLE DB Destination [5160]     
    Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "DestinationClearData" failed with error code 0xC0202009.  There may be error messages posted before
    this with more information on why the AcquireConnection method ca...  The package execution fa...  The step failed.
    So I hope somebody can shed some hints or tips for me to overcome time problem of mine. Thanks for your help in advance. As I had scoured thoroughout MSDN forums & found none solution for my problem yet. 
    PS: In the SQL Integrated Services when I deployed the package I set the security of the packages to Rely on server... 
    Hope this will help.

    Hi Ironmaidenroxz,
    From the message “Executed as user: MSSQLServer\SYSTEM”, we can see that the SQL Server Agent job ran under the Local System account. However, a Local System account doesn’t have the network rights natively, therefore, the job failed to communicate with
    the remote IBMAS400 server.
    To address this issue, you need to create a proxy account for SQL Server Agent to run the job. When creating the credentials for the proxy account, you can use the Windows domain account under which you executed the package manually.
    References:
    How to: Create a Credential
    How to: Create a Proxy
    Regards,
    Mike Yin
    TechNet Community Support

Maybe you are looking for

  • TS3999 iPhone 5 v 7.0.4 and icloud calendar issue

    I have an iPhone 5 v 7.0.4 and all of a sudden entries I make on my calendar are not appearing when I log into icloud.  I can make an entry via my laptop or pc and it will appear on my iPhone but not vice versa. I have tried deleting the account from

  • Can i call a stored procedure from OracleDashboardPrompt?

    Hi, Can i call a stored procedure from OracleDashboardPrompt once i click the Go button in OBIEE?The input parameters to the procedure are the one that i have given in DashboardPrompt.and based on the result of the procedure(either 0 or 1),i have to

  • Adobe design premium cs3 suddenly stopped working

    hi - my adobe design premium cs3 suddenly stopped working. i tried uninstalling and reinstalling but it won't let me. it goes through the motions and in the end only adobe reader gets installed. it says component install fail but doesn't give a reaso

  • InfoView Default Crystal Report Viewer to Java

    Anyone know how to do set the Infoview Crystal Report Viewer to Java as default in R3.1 ? We can do it from R2 CMC  but not anymore since upgrade. Our client computer doesn't allow ActiveX download. Thanks In advance, Tommy

  • Need scrollpane help

    i am making a website and as the title says need some help with the scroll pans that im working on. i made the scroll pane gave it the instance name menupagescroll, made my comtent i want to display in there, enter the coe menupagescroll.source = men