How to configure send mail task dynamically in SSIS using Package Configuration - ssis

I have a send mail task which sends the excel as attachment. We have couple of ids in CC, BCC and to. I want to configue send mail task dynamically using package configuration, So it takes all ids, message subject, and messageSourse dynamically. How to achieve this in SSIS?
And I have to configure that smtp connection also through package configuration.
Thanks in advance

Create variables for each aspect of the Mail task you would like configure, then map those variables to the various properties of the Mail task.
You will need another string variable for the SMTP server name, which gets mapped in the properties of the connection manager.
Once the variables are created and mapped, open the package configuration settings and map the variables to the package configuration.

Related

Dynamic Configuration of Script Task in SSIS

I have to execute a VB script on some data from a CRM database in a data flow task. I want to make it configurable on other system as well.
I am able to assign the connection string of the connection manager dynamically by configuring through variable using a configuration file. Is there any way to configure the ScriptLink property of Script Component Editor so that I can make the address of the script dynamic.
I have also tried CozyRoc Script Task + also but am still confused. I will highly appreciate any help.

receive excel file name as a parameter in SSIS package from .net

I've a SSIS package called from .NET and I need to receive a filename as a parameter to use in the connection manager
How can I receive it in SSIS package?
You can use the /SET option of DTSExec to do this when executing the package. With this, you can set a package variable you defined earlier.
For more information, have a look at this and the official microsoft help here.
you can load it from a configuration file (example here) and set the name dinamically using expressions (example here)

Dynamic ConnectionString in Connection Manager (OLE DB)

I have a local database table that contains 50+ external data sources from which I can build a connection string. I am currently trying to setup SSIS to dynamically build connection strings from this table and pass them to the connection manager. I have successfully set a variable and assigned this variable to the ConnectionString expression property in Connection Manager.
I then use an OLE DB source object to copy a table from this source to our local database. The problem is that if the connection string is not set at design time I get validation errors for the OLE DB object.
If I manually set the connection string property it works fine, but that defeats the perpose of creating the dynamic connectionstring variable.
The idea here is to have the dynamic partion detect what machine it is running from and build the proper string (DEV, UAT, QA). I also do not want these connection strings in a dtsConfig file.
I took a look at this: http://www.simple-talk.com/sql/ssis/working-with-property-expressions-in-sql-server-integration-services/, but it does not have any solution for my situation.
I just found the solution after reading the first line of that error "Package Validation Error" I went to the package properties and changed DelayValidation to True.
I guess asking questions here really does help you find your own solution.

Run SSIS Package with 2 Different Configurations

We have a SSIS job called ExportData and it accepts the 'ExportType' Parameter. The ExportType parameter can be 'schedule' or 'unschedule'.
I created the Variable called '#ExportType' and created the SSIS Configuration and expose the variable in the Configuration file and called it 'ScheduleConfig'. I copied that file and change the value to 'unschedule' and called it 'UnscheduleConfig'.
I created the SSIS Job in the SQL Server 2008 and set up 2 steps for both 'Schedule' and 'Unschedule'. I attached the correct config file for each Step. But whichever step I run, it always execute 'Schedule'. I am sure and double checked the Config files and Steps.
How can I run 2 different jobs with 2 different configuration files?
I did try by using the SetValues method and it doesn't work too.
I suggest you not store #ExportType in an SSIS Configuration. You can override the value from the DTEXEC command line by adding a SET switch similar to:
/SET "\Package.Variables[ExportType].Properties[Value]";Schedule
You can use the same PackagePath above to override this variable value in the SQL Agent Integration Services Job Step Type on the Set Values tab.
Hope this helps,
Andy
If I understand your requirements correctly. here is a sample package created in SSIS 2008 R2 and does what you are looking for. The sample uses a single package, which is executed under two different SQL agent job steps and both the steps use a different copies of the same configuration file. The configuration files hold different values for the variable used inside the package.
Created a sample SSIS package named SO_10177578. Within the package, created a package variable named ExportType of data type String. Also, placed the Execute SQL Task on the Control Flow tab. This task will help to identify the value being passed to the variable ExportType.
Added the OLE DB connection to a sample database and named the connection as SQLServer. I chose to use SQL Server authentication for this connection manager.
Within the SQL database, created a table named dbo.ExportData with the following strucutre. Id column is a identity column.
The table doesn't contain any data to begin with. This table will be populated with data when the package is executed.
On the SSIS package, clicked on the SSIS menu --> selected Package Configuration option. On the Package Configurations Organizer dialog, selected the Enable package configurations checkbox and clicked on the Add button. Created a new package configuration of the type XML Configuration file. Selected a path to store the file.
Added the Value property of the variable ExportType and the ConnectionString property of the connection manager SQLServer to the configuration file.
On the Execute SQL Task, selected the Connection to be SQLServer and set the SQLStatement property to INSERT INTO dbo.ExportData (PackageName, ExportTypeValue) VALUES (?, ?)
Configured both the parameters to the appropriate variables available on the package. Now the package is ready for deployment.
On the database server's SQL Agent node, created a new SQL job named Test_ExportData. Owner field information is removed to hide sensitive information.
On the SQL job's Steps page, created two steps named Step_01 and Step_02.
Step 1 is configured as below with the package being stored in the path c:\temp\SO_10177578.dtsx.
Copied the package configuration file created using the package and changed the value for the variable ExportType to Schedule. Named the configuration file as ScheduleConfig.dtsConfig. Screenshot shows only part of the configuration file to hide sensitive connection string information.
In step 1 of the job, referred the newly created package configuration file from the path c:\temp\Test\ScheduleConfig.dtsConfig.
Step 2 is configured as below and it uses the same package stored in the path c:\temp\SO_10177578.dtsx as used by step 1.
Copied the package configuration file created using the package and changed the value for the variable ExportType to Unschedule. Named the configuration file as UnscheduleConfig.dtsConfig. Screenshot shows only part of the configuration file to hide sensitive connection string information.
In step 2 of the job, referred the newly created package configuration file from the path c:\temp\Test\UnscheduleConfig.dtsConfig.
Now, both the steps are configured. Executed the new SQL agent job.
Queried the table ExportData. You can notice that the package was executed twice and each execution in the SQL agent job's steps used the appropriate configuration files specified on the steps.
Hope that helps.
you cant do that. The SSIS wont read the new configuration.
You need to call the package twice, one time with config file A and one time with config file B. On each config file you will have the #ExportType variable set to 'schedule' and 'unschedule'.
You can only set a parameter once. Even if you use DTEXEC with the /Config option for example you CANT overwrite a parameter that is already set

SSRS Dynamically change Datasource connection String

I want to modify the connection String of a Shared Data Source on a report Server. the reason is, every week we deploy new data on the server, so I am planning to deploy new database, test it and modify the datasource so that it than connect to new database, then remove the old database.
Can anyone help me in the regards.
I tried to use this post: Updating Shared data source connection string programmatically
but I can not create ReportingService2005 object as dll is missing to which this object points.
Thanks
ReportingServices2005 is not a dll, it's a webservice
The URL is formatted as below for most 2005 instances:
https://<<Report Server Name>>/ReportServer/ReportService2005.asmx
If you add the web reference the solution you have should work
An alternative to creating a custom application to do this is to use the rs.exe utility to execute the code as a script.
Scripting with the rs Utility and the Web Service