SSIS package to do SSRS email subscriptions

I know how silly the title is, but anyways I am going to ask this question...
I have a Main report and a sub-report in SSRS, I need to send out an email every time a new entry is generated/added to the database...
And I need to send the sub-report link in an email so the user could see the data for the new entry...
Need to automate this process by building an SSIS package that works exactly like SSRS email Subscriptions...
Thanks in advance...
Dhananjay Rele

Hi Dhananjay,
As Arthur said, in the SSIS package, you can use a Send Mail Task to send emails with the URL of the sub-report in the message source. Then, create a job to run the SSIS Package, and create a after insert trigger on the target database table to start the
job once a new records is inserted into the target table. The script to create the trigger is like:
CREATE TRIGGER TriggerName ON TableName
AFTER INSERT
AS
EXEC msdb..sp_start_job
@job_name=’JobName’;
Go
In addition, if you would like, you can run a SSRS report subscription to export a report to a shared folder, and then attach the exported file as the attachment of the mail when configuring the Send Mail Task.
Regards,
Mike Yin
TechNet Community Support

Similar Messages

  • Email attachments from SSRS email subscription are not being uploaded to an email enabled SharePoint 2013 document library

    Email attachments from SSRS email subscription are not being uploaded to an email enabled SharePoint 2013 document library.
    I have tested the library using a standard email (with attachment) to the library and this works fine. 
    I have monitored the drop folder on the server and I can see both emails being picked up in drop and processed by SharePoint.  The email sent from a regular email account is uploaded with the attachment, whereas the email sent via SSRS subscription
    email is uploaded and the attachment (report) is missing.

    An update on this.  The email when sending from SSRS subscription is received in the library and the attachment is contained within the .EML file uploaded.
    The behaviour that I would like from SSRS subscription emails are to just have the document and not the email.
    Below is a snippet of the .EML files I quick copied from the Drop folder.
    Email attachment snippet sent from SSRS Subscrption:
    ----boundary_2477_75fa3d73-56de-4948-ad82-6588f3a35b95
    Content-Type: application/octet-stream; name="Toilet Usage by Month.docx"
    Content-Transfer-Encoding: base64
    Content-Dis;
     filename="=?utf-8?B?VG9pbGV0IFVzYWdlIGJ5IE1vbnRoLmRvY3g=?="
    Content-ID: <10722c0f-749e-4ecb-ac3f-206317bae734>
    UEsDBBQAAAAIAEVcbEY4Xh4a5nsAAPJtMQARABwAd29yZC9kb2N1bWVudC54bWwgohgA
    KKAUAAAAAAAAAAAAAAAAAAAAAAAAAAAA7N1rr1/XcSforyL4VRooR3vd9to76Kihjto9
    I8T2TDvAzFuaPrE1kUiCouxWPv38DyX50nHSniCdyS96bIAUL+d/LnxO7Vq11qr6j//p
    v3/x+Qe/fnr75WevX/3lD9qfHz/44OnVy9e/+OzVL//yB1+9+9sfXj/44Mt3L1794sXn
    r189/eUPvn768gcf/KeP/uNv/uIXr19+9cXTq3cfPF7h1Zd/8evHH/7q3bs3f/Hhh1++
    /NXTFy++/PPXb55ePf7wb1+//eLFu8cv3/7ywy9evP27r9788OXrL968ePfZzz/7/LN3
    X3/Yj+P8wbcv8/rxXt+++otvX+KHX3z28u3rL1//7bvnN/mL13/7t5+9fPr2p+/e4os/
    5f1+8yaffPshv3+Pj4/l3a++e5Ff/1Pv9tdffP7d3/vNmz/lvf3i7YvfPL6AX3z+zTv6
    Email attachment snippet sent from Outlook:
    --_004_A4C6DCEDE4346446A79AFF493D278530FB87FA07MELABCDEXA1airp_
    Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document;
     name="Toilet Usage by Month.docx"
    Content-Description: Toilet Usage by Month.docx
    Content-Dis; filename="Toilet Usage by Month.docx";
     size=76574; creation-date="Thu, 12 Mar 2015 00:41:14 GMT";
     modification-date="Thu, 12 Mar 2015 00:41:14 GMT"
    Content-Transfer-Encoding: base64
    UEsDBBQAAAAIAMJcbEY4Xh4a5nsAAPJtMQARABwAd29yZC9kb2N1bWVudC54bWwgohgAKKAUAAAA
    AAAAAAAAAAAAAAAAAAAAAAAA7N1rr1/XcSforyL4VRooR3vd9to76Kihjto9I8T2TDvAzFuaPrE1
    kUiCouxWPv38DyX50nHSniCdyS96bIAUL+d/LnxO7Vq11qr6j//pv3/x+Qe/fnr75WevX/3lD9qf
    Hz/44OnVy9e/+OzVL//yB1+9+9sfXj/44Mt3L1794sXnr189/eUPvn768gcf/KeP/uNv/uIXr19+
    9cXTq3cfPF7h1Zd/8evHH/7q3bs3f/Hhh1++/NXTFy++/PPXb55ePf7wb1+//eLFu8cv3/7ywy9e
    vP27r9788OXrL968ePfZzz/7/LN3X3/Yj+P8wbcv8/rxXt+++otvX+KHX3z28u3rL1//7bvnN/mL

  • SSRS email subscription uses incorrect content-type header

    We are using SSRS to deliver emails with reports attached as PDF.
    Some mail clients are fine with this and use the correct filename. However other mail clients get confused  specially mobile phone clients. For example, the Android web mail app thinks the filename is "application/pdf" - it is actually reading
    the "name" portion of the Content-Type header. Our Goldmine mail client reads the correct filename but changes the dot to an underscore... e.g. "myreport_pdf".
    Can anyone help me?
    Thank you
    Nuno Ferreira

    Sorry for the mix up, sql server is 2014, but reports is 2012.
    Nuno Ferreira

  • Configure Yahoo for email subscriptions

    Hi,
    Please help me how to configure yahoo mail server (yahoo SMTP) for SSRS email subscriptions.
    Thanks in advance.
    Virendra Yaduvanshi http://wikidba.wordpress.com/

    Hi Virendra,
    According to your description, you want to use Yahoo SMTP to configure Email delivery extension for SSRS subscription.
    In your scenario, you should use virtual SMTP server feature in IIS to set Yahoo SMTP server. Then you should use the Reporting Services Configuration Manager to minimally configure the extension. To set advanced properties, you must edit the RSReportServer.config
    file (default location: %programfiles%\Microsoft SQL Server\<instance name>\Reporting Services\ReportServer).
    Reference:
    Setting up SMTP server in Windows .. to use Gmail
    Configure a Report Server for E-Mail Delivery (SSRS Configuration Manager)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • How to find an SSRS report subscription was executed 3 days back and sent an Email to the requested person or group?

    Hi All,
    I got complain that one of my reports which was subscribed from SSRS Report Manager could not delivered to targeted people 3 days back. 
    I want to to check that Email was sent or not So I wrote below query but I think table  will be over written on each execution of subscription and cannot see the history. I can see only the latest data.
    SELECT A.NAME,B.Description,B.LastStatus,B.LastRunTime 
    FROM [dbo].[Catalog] A
    INNER JOIN [dbo].[Subscriptions] B ON A.ItemID=B.Report_OID
    WHERE TYPE=2 
    AND NAME='REPORT_NAME'
    AND B.LastStatus LIKE '%EMAIL ID%'
    AND B.LastRunTime>Getdate()-1
    ORDER BY B.LastRunTime
    There is another query which says that report was rendered by SUBSCRIPTION and have no track that Email was sent or not.
    --Query to find out how a report was execute 
    SELECT * FROM EXECUTIONLOG3 
    WHERE REQUESTTYPE='SUBSCRIPTION'
    AND ITEMPATH LIKE '%REPORT NAME'
    ORDER BY TIMESTART DESC
    There is any way to track this?
    https://msdn.microsoft.com/en-us/library/ms159110.aspx
    http://blogs.msdn.com/b/deanka/archive/2009/01/13/diagnosing-and-troubleshooting-subscriptions.aspx
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Hi S Kumar Dubey,
    According to your description, you want to find the failed subscription report and resent the report to users again.
    In this scenario, you can run the query below to find the failed subscription.
    use ReportServer
    go
    SELECT C.Name, S.LastRunTime, S.LastStatus, S.Description
    FROM Subscriptions AS S
    LEFT OUTER JOIN [Catalog] AS C
    ON C.ItemID = S.Report_OID
    WHERE LEFT (S.LastStatus, 12) != 'Mail sent to'
    AND LEFT (S.LastStatus, 12) != 'New Subscrip'
    Then you can execute the code with jobstep command below to find the corresponding SQL Agent Jobs for failed subscription, then execute the job to send the email again.
    select 'exec sp_start_job @job_name = ''' + cast(j.name as varchar(40)) + ''''
    from msdb.dbo.sysjobs j
    join msdb.dbo.sysjobsteps js on js.job_id = j.job_id
    join [ReportServer].[dbo].[Subscriptions] s on js.command like '%' + cast(s.subscriptionid as varchar(40)) + '%'
    where s.LastStatus like 'Failure sending mail%';
    Reference:
    SSRS Failed Subscription Notifications
    Re-running SSRS subscription jobs that have failed
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • SSRS unable to send email subscription notification using SendGrid from a VM/AZURE

    In SSRS (using a VM in AZURE) I configured eMail  to use SendGrid.
    When the subscription triggered I get the following error:
    Failure sending mail: Mailbox unavailable. The server response was: Cannot receive from specified address <[email protected]>: Unauthenticated senders not allowed
    I talked to SendGrid support and they say that you need to be authenticated (They provided a username and password when I registered) but I can't find the way to provide the credentials. I tried to insert them in the rsreportserver.config file but if I change
    SMTPAuthenticate to 1, to use the credentials, the email option doesn't show in the subscription setting form in SSRS (See below).
    <Configuration>
                        <RSEmailDPConfiguration>
                            <SMTPServer>smtp.sendgrid.net</SMTPServer>
                            <SMTPServerPort>
                            </SMTPServerPort>
                            <SMTPAccountName>
                            </SMTPAccountName>
                            <SMTPConnectionTimeout>
                            </SMTPConnectionTimeout>
                            <SMTPServerPickupDirectory>
                            </SMTPServerPickupDirectory>
                            <SMTPUseSSL>
                            </SMTPUseSSL>
                            <SendUsing>2</SendUsing>
                            <SMTPAuthenticate>2</SMTPAuthenticate>
                            <sendusername>[email protected]</sendusername>
                            <sendpassword>sw76929u5RabclB</sendpassword>
                            <From>[email protected]</From>
                            <EmbeddedRenderFormats>
                                <RenderingExtension>MHTML</RenderingExtension>
                            </EmbeddedRenderFormats>
                            <PrivilegedUserRenderFormats>
                            </PrivilegedUserRenderFormats>
                            <ExcludedRenderFormats>
                                <RenderingExtension>HTMLOWC</RenderingExtension>
                                <RenderingExtension>NULL</RenderingExtension>
                                <RenderingExtension>RGDI</RenderingExtension>
                            </ExcludedRenderFormats>
                            <SendEmailToUserAlias>False</SendEmailToUserAlias>
                            <DefaultHostName>
                            </DefaultHostName>
                            <PermittedHosts>
                            </PermittedHosts>
                        </RSEmailDPConfiguration>
                    </Configuration>
    Is there any other SMTP that I can use in a AZURE VM that will send email just using a valid email (I can do that in my internal SMTP)?
    Is there a way to provide the credentials?
    Thanks in advance!

    Hi SendGrid,
    According to your description, you want to use the SendGrid SMTP server for configuring email subscription. Now you have the problem on sending the credential to access the SendGrid SMTP server. Right?
    In Reporting Services, when configuring subscription, we need to specify a Windows domain user to run the Reporting Services. Definitely this domain user credential can't access the SendGrid SMTP server. In this scenario, we need to install the Local
    SMTP server and configure the SMTP virtual server. And we can put credential in Access Control. For detail steps, please refer to similar threads below:
    How to configure SSRS Report Subscriptions to use Gmail for GP  
    Using
    Google SMTP server (smtp.gmail.com) when configuring subscriptions unders SSRS 2008
    Reference:
    How to: Install and Configure SMTP Virtual Servers in IIS 6.0
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to execute an SSIS package on a scheduled basis from remote server and pass in input files

    I have an application server and a db server.  My db server has all things SQL Server stored on it (DBMS, SSRS, SSIS, etc.)  I have several nightly batch process SSIS packages (dtsx files currently) that will pickup an input file and import them
    into the database.  I would like to execute all batch processes from my application server as I have quite a few other ones as well that do other stuff outside of SQL Server via powershell.  My question is how to do this?  Is there away to execute
    them remotely via DTexec.exe, should I set them up as Agent jobs and somehow pass in the file names\location (how?), create and SSIS catalog, etc.?  
    I need to easily be able to see if the packages execute successfully or not and if not capture the detailed information of why they failed from the remote server so I can use that to drive my process flow logic in the batch processes.

    Hi Jason,
    According to your description, you want to execute a package on a schedule and receive notification when package ends with error in the job.
    After testing the issue in my environment, we can directly add the package in a step of a job, then add a schedule and set the Alert and Notification property in the job to achieve your requirement. For more details, please see:
    Create a Database Mail in the SSMS.
    Right-click the SQL Server Agent services to Enable mail profile, then select the appropriate Mail profile.
    Under the Operators folder, create an operator with the correct E-mail name.
    Right-click the Jobs folder to add a new job.
    In the Steps pane, New a step with SQL Server Integration Services Package Type to run the package.
    In the Schedules pane, New a schedule for the job.
    In the Alerts pane, New an alert with SQL Server event alert, then enable Notify operators option with an operator in the Response pane.
    In the Notifications pane, enable Email option with same operator and When the job fails selection.
    Then when the package fails, the job would be failed and we can receive the error message in the mailbox.
    Besides, please make sure the account that execute the job has correct permissions for the file, for the folder that contains the file, and for the database.
    References:
    Configure Database Mail – Send Email From SQL Database
    How to setup SQL Server alerts and email operator notifications
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • SSRS 2012 Subscription Error in Test Environment

    Hi All,
    I was trying to set-up Email Subscription for SSRS in my Test Environment using "Reporting Services Configuration Manager" and after providing SMTP server details. I was getting error "Failed to sent Email to [email protected]"
    What could be the reason?
    I tried pining SMTP IP address from the Machine where SSRS installed and I was able to ping SMTP Server using CMD ping command.
    Thanks Shiven:) If Answer is Helpful, Please Vote

    Hi All,
    I found the issue. The IP address of Machine, where SSRS server installed, was not included in to the SMTP relay and that's why I was getting error "Failed
    to sent Email to [email protected]".
    Once my network team, added IP address, it started working fine.
    Another thing I noticed, due to some reason SQL Server Agent was stopped and was not running and one
    of my colleagues was trying to create new subscription and was getting error 'The SQL Agent service is not running. This operation requires the SQL Agent service. (rsSchedulerNotResponding)'.
    Once I started SQL Server Agent, My colleague was able to create new subscription. 
    Thanks Shiven:) If Answer is Helpful, Please Vote

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

  • 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

  • Running SSIS Package from SQL Job - with Set Values, a string containing";"

    Can anybody help with this problem please?
    I’m using “set value” in SQL agent to pass in an email address to my SSIS package, if I put in a value of:
    [email protected]
    It works fine, but if I attempt to input multiple email addresses it fails
    [email protected];[email protected]
    It doesn’t appear to like the “;”.
    Any ideas anyone???
    BoroFC

    Hi Jamie, many thanks for the response.
    If I look at my command line table when Email = [email protected], it looks like:
    /SET "\package.Variables[EmailAddress].Value";"[email protected]" /REPORTING E
    If I change the value to “[email protected];[email protected]”, it looks like:
    /SET "\package.Variables[EmailAddress].Value";"\""" [email protected];"" [email protected] ""\"" /REPORTING E
    But the weird thing is, if I close the job properties window and re-open it again, I lose this line from my set values screen all together!!!
    Help ???
    BoroFC

  • Error when exporting to xslx using export wizard or SSIS package

    Greetings:
    SQL Server 2008 R2, SSMS version 10.50.2500.0
    I tried to use the import/export wizard to create a SSIS package that takes the results of a query and outputs to an excel file. 
    Here is the table it is deriving from:
    CREATE TABLE OrderTravOutput (
    TravelerID int
    ,FirstName varchar(255)
    ,LastName varchar(255)
    ,Email varchar(255)
    ,Email2 varchar(255)
    ,Cell varchar(255)
    ,OrderID varchar(255)
    ,OrderSkillSet varchar(255)
    ,FacilityName varchar(255)
    ,City varchar(255)
    ,StateProvinceID varchar(255)
    ,ParentID int
    ,HealthSystem varchar(255)
    ,UnitName varchar(255)
    ,LastContact datetime
    ,OrderStart datetime
    ,OrderEnd datetime
    ,Tag varchar(255)
    ,CompleteDate datetime
    ,Recruiter varchar(255)
    ,Brand varchar(255)
    ,RecruiterEmail varchar(255)
    ,NumberOfWeeks int
    ,OrderShifts varchar(255)
    ,MaxPayrate varchar(255)
    ,FileOut int
    ,JobDescription varchar(max)
    ,RequiredQualifications varchar(max)
    ,PreferredQualifications varchar(max))
    Here is the query being used in the wizard:
    select DISTINCT r2.*
    from OrderTravOutput r2
    JOIN OrderTravOutput r3 ON r2.OrderID = r3.OrderID
    AND r2.CompleteDate = (SELECT max(CompleteDate)
    FROM OrderTravOutput
    WHERE OrderID = r2.OrderID
    AND TravelerID = r2.TravelerID
    AND r2.OrderSkillSet = ( SELECT TOP 1 OrderSkillSet
    FROM OrderTravOutput
    WHERE OrderID = r2.OrderID
    AND TravelerID = r2.TravelerID)
    When I run it, it fails. Here is the report:
    Operation stopped...
    - Initializing Data Flow Task (Success)
    - Initializing Connections (Success)
    - Setting SQL Command (Success)
    - Setting Source Connection (Success)
    - Setting Destination Connection (Success)
    - Validating (Success)
    - Saving (Success)
    - Prepare for Execute (Success)
    - Pre-execute (Error)
    Messages
    * Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E21.
    (SQL Server Import and Export Wizard)
    * Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
    (SQL Server Import and Export Wizard)
    * Error 0xc004701a: Data Flow Task 1: component "Destination - Query" (103) failed the pre-execute phase and returned error code 0xC0202025.
    (SQL Server Import and Export Wizard)
    - Executing (Warning)
    Messages
    * Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)
    * Warning: Preparation SQL Task 1: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (SQL Server Import and Export Wizard)
    - Copying to `Query` (Stopped)
    - Post-execute (Stopped)
    Messages
    * Information 0x4004300b: Data Flow Task 1: "component "Destination - Query" (103)" wrote 0 rows.
    (SQL Server Import and Export Wizard)
    What did I do wrong?
    Thanks for any help. 

    I see some possible problems with the query.  Does it return expected results when executed in the Query window in SQL Server Management Studio (SSMS)?
    1.  You will want to specify fields explicitly in the select list, rather than using "*"
    2.  You will want to add r3 and r4 aliases in the subqueries, because OrderTravOutput r2 and r3 are definitely in scope there, and specifying an unqualified "OrderID" in the join condition would be ambiguous.
    3.  Add an ORDER BY clause to the second subquery, because otherwise TOP 1 OrderSkillSet is meaningless.
    4.  The intersection of these two subqueries may exclude records you want to see.  For example, you might have 20 records for a particular combination of OrderID and TravelerID.  But if one of those records has
    the MAX(CompleteDate) and a different record has the TOP 1 OrderSkillSet, the query will return zero records for this OrderID and TravelerID, because there is no single record that satisfies both conditions.  Is this what you intend?  Running the
    query first in SSMS helps to clarify whether it is returning the expected results.
    Anyway, you could start with something like this version of the query:
    SELECT DISTINCT r2.TravelerID,
    r2.FirstName,
    r2.LastName,
    r2.Email
    FROM OrderTravOutput r2
    JOIN OrderTravOutput r3 ON r2.OrderID = r3.OrderID
    AND r2.CompleteDate = (SELECT MAX(CompleteDate)
    FROM OrderTravOutput r3
    WHERE r3.OrderID = r2.OrderID
    AND r3.TravelerID = r2.TravelerID)
    AND r2.OrderSkillSet = (SELECT TOP 1 OrderSkillSet
    FROM OrderTravOutput r4
    WHERE r4.OrderID = r2.OrderID
    AND r4.TravelerID = r2.TravelerID
    ORDER BY r4.OrderSkillSet)

  • SSIS Package execution error from powershell

    Hi I have written a powershell script to exec SSIS packages. I am passing variable values at runtime by reading it from a text file.
    But it throws an error.
    Here is my script.
    #Read Data from Parameter File
    $variable=Get-Content D:\Batch\Bin\ETLParameters.txt
    $variable.GetType()
     $dest_conn_str=$variable[1]
     $mail_cc=$variable[2]
     $mail_from=$variable[3]
     $mail_str=$variable[4]
     $mail_to=$variable[5]
     $pkg_path=$variable[6]
     $ps_exe_path=$variable[7]
     $ps_script_cmd=$variable[8]
     $ps_script_path=$variable[9]
     $src_conn_str=$variable[10]
     $src_sys_id=$variable[11]
    #Executing SSIS packages from command prompt
    $cmd = 'dtexec /f "' + $pkg_path + 'pkg_ntas_all.dtsx' + '"' + ' /SET \Package.Variables[User::src_conn_str].Properties[Value];"' + $src_conn_str + '"' + ' /SET \Package.Variables[User::dest_conn_str].Properties[Value];"'
    + $dest_conn_str + '"' + ' /SET \Package.Variables[User::src_sys_id].Properties[Value];"' + $src_sys_id + '"' + ' /SET \Package.Variables[User::pkg_file_path].Properties[Value];"' + $pkg_path + '"' +
    ' /SET \Package.Variables[User::mail_str].Properties[Value];"' + $mail_str + '"' + ' /SET \Package.Variables[User::mail_from].Properties[Value];"' + $mail_from + '"' + ' /SET \Package.Variables[User::mail_to].Properties[Value];"'
    + $mail_to + '"'+ ' /SET \Package.Variables[User::mail_cc].Properties[Value];"' + $mail_cc + '"' + ' /SET \Package.Variables[User::ps_exe_path].Properties[Value];"' + $ps_exe_path + '"' + ' /SET
    \Package.Variables[User::ps_script_path].Properties[Value];"' + $ps_script_path + '"' + ' /SET \Package.Variables[User::ps_script_cmd].Properties[Value];"' + $ps_script_cmd + '"'  
    $cmd
    DECLARE @returncode int
    EXEC @returncode = xp_cmdshell @cmd
    Types of error that I get -
    If I run the $cmd directly. Which is the concatenated string of dtexec command with parameters. It doesn't do anything, not even an error and the pwoershell execution just completes.
    If I use exec EXEC @returncode = xp_cmdshell @cmd    ----- Then it throws me the error that the exec is not recognized name of cmdlet.
    Please help as I a noob in any kind of scripting.

    I did but it just printed the entire string on the command line and assigned all the values.
    PS C:\Users\dev_setup> . D:\Batch\Bin\runETL.ps1
    IsPublic IsSerial Name                                     BaseType
    True     True     Object[]                                
    System.Array
    dtexec /f "D:\ETL\test\test\test_ETL\pkg_all.dtsx" /SET "\Package.
    Variables[User::src_conn_str].Properties[Value]";"Data Source=SOURCE1;Initial Catalog=tagtest;Provider=SAOLEDB.11;Integrated Security=SSPI;
    " /SET "\Package.Variables[User::dest_conn_str].Properties[Value]";"destinationDb;User ID=FP_DEV;Password=**********;Initial Catalog=xyz;Provider=SQLOLEDB.1;Persist Security Info=True;Auto Translate=False;Packet Size=10240;" /SET " \Package.Variables[User::src_sys_id].Properties[Value]
    ";"100200" /SET "\Package.Variables[User::pkg_file_path].Properties[Value]";"D:\ETL\test\test\test_ETL\" /SET "\Package.Variables[User::mail_str].Properties[Value]";"SmtpServer=mailhost.test.com;UseWindowsAuthentication=False;EnableSsl=False;" /SET "\Package.Variables[User::mail_from].Properties[Value]
    ";"[email protected]" /SET "\Package.Variables[User::mail_to].Properties[Value]";"[email protected]" /SET "\Package.Variables[User::mail_cc].Properties[Value]";"[email protected]" /SET "\Package.Variables[User::ps_exe_path].Properties[Value]";"C:\Windows\System32\WindowsPower
    Shell\v1.0\PowerShell.exe" /SET "\Package.Variables[User::ps_script_path].Properties[Value]";"D:\ETL\Powershell_Script\" /SET "\Package.Variables[User::ps_script_cmd].Properties[Value]";"create_historical_reject_file.ps1 -input_variable"
    PS C:\Users\svc_sp_fp_dev_setup>
    But when I just run it without passing the parameters it runs. What might be the issue.

  • Sp_replmonitorhelppublication in a SSIS package

    Hi
    The SSIS package has a step where it calls for a DB snapshot replication (SQL Agent Job) to start after it has updated the database on server A.
    I want SSIS to wait till this snapshot generation and subscription has finished before going to the next task. The following task requires access to the tables that are being replicated, therefore need to be available.
    Will appreciated if someone could advise on how to use sp_replmonitorhelppublication and SP_replmonitorhelpsubscription to get the status for replication and only allow the SSIS package to progress once replication is finished.
    Thanks
    DBA

    Hi Hailey, you can use a Execute SQL Task to run specific T-SQL script to get the status whether the replication is finished, and assign a value to a SSIS variable. Then, the variable can be used in For Loop Container to determine whether go to the next
    step to process the package:
    http://www.bidn.com/blogs/mikedavis/ssis/158/make-an-ssis-package-delay-or-wait-for-data
    Regards, Leo

  • Error while processing with XML but not with SSIS Package

    Hi All,
    In the project that I am currently working we are using SQL Server 2005 and its components. We recently upgraded SSRS 2005 to 2008. Now we are in the process of upgrading SSAS from 2005 to 2008.
    To process the cubes in 2005 version, we were using 2 methods. One is using XML and the other is SSIS packages. We upgraded one of our cubes to 2008 and we are unable to process the cube using XML but its  processing fine when we are using SSIS package.
    I Suspect it is something to do with the "Ignore Dimension Key Errors". There are some dimension keys that are missing. It was working fine in 2005 version and also in 2008 version with SSIS.
    Please help me with this and let me know the reasons why this happens.
    Thanks
    Vineesh
    vineesh1701

    Hi Thomas,
    Below are the things you have asked for.
    1.      
    We are running XMLA Scripts as jobs Under SQL Server Agent. The job fails.  But cube is processed and the key errors are logged in the specified path.
    2.      
    The same script runs fine in Management Studio.
    Executed as user: XXXX. <return xmlns="urn:schemas-microsoft-com:xml-analysis"><results xmlns="http://schemas.microsoft.com/analysisservices/2003/xmla-multipleresults"><root
    xmlns="urn:schemas-microsoft-com:xml-analysis:empty"><Messages xmlns="urn:schemas-microsoft-com:xml-analysis:exception"><Warning WarningCode="1092354050" Description="Server: Operation completed with 17 problems logged." Source="Microsoft SQL Server
    2008 R2 Analysis Services" HelpFile="" /></Messages></root></results></return>.  The step failed.
    Thanks
    Vineesh
    vineesh1701

Maybe you are looking for