How to create DDL from output columns in SSIS - ssis

I have DataFlow task which has been created programmatically,
The data source connected with DBMS via OLE DB Provider,
I can get output columns from the source and map then with input columns of destination component.
But I can't invoke ReinitializeMetaData() for destination component because destination table doesn't exist.
Therefore, I want to get DDL from output columns for creating the table.
Maybe, someone knows which functionality is provided in SSIS for this purpose?
Thanks in advance

Related

SSIS - How to create staging table in Ole db destination on the fly

I am new to SSIS space while developing incremental data load SSIS package I am trying to load data from ole db destination to database. however I can't find a way to create destination table dynamically?
This is my package I am using project level parameter to input Source conn string(pSourceConnectionString) destination conn string (pDestiConnectionString)
source table (pSourceTable) destination table (pDestiTable).
Similar problem
You could do it with a script component as your destination. The script would start with a command that creates the table if it doesn't exist, and then would insert the incoming rows to it.
There is no way to create an OLEDB Destination to a table that doesn't yet exist. However, you could also look into BiML which lets you dynamically create packages based on meta data.

SQL Server Integration Services

I am using SSIS to import an Excel file into a table in my SQL Server 2008 database.
Currently I am able to import data into the table by using data flow setting Excel file as the source and data table as the destination. My current import is based on the column mapping between source and the destination, but now I want to add an extra column to the table (basically this column will have the id that is given to the Excel file of which the rows are part of, so this value will be same for each row that belongs to the file whose data we are currently importing)
This column is not present in the source Excel sheet and its value is in a SSIS user variable. I want the insertion of this value a part of the import process, but I cannot figure it out?
How can I achieve this?
The connection manager for the destination doesn't allow me to map user variables to columns...
Put in a Derived column between the Excel Source and the Database destination.
Create a column there and use the SSIS User Variable as the value expression for the column.
Add a execute SQL task after the dataflow task and update the extra column with the variable with an update statement.

SSIS dynamic source and destination tables

I have some requirements as explained below:
I need to have a SSIS data data flow task,which will accept the input parameters as
--SourceServer Connection String
--DestinationServer Connection String
--Source Table Name
--Destination Table Name
Then It should do the column mapping of source and destination tables dynamically at run time.
The source and destination tables schema would be same always.
I want to call this package by passing the above parameters from C#.net.
One main thing is here I will have to pass different sets of source and destination tables.
just answered this on a previous question. You cant loop through tables and dinamically map columns on your source and destinations components. You would need one set of Source -> Ddestination per table.
If that's not feasible, you may want to lokk at the Transfer SQL Server Objects Task
Create SSIS Packages parameters. Set web.config file for passing that parameters.
First you deploy the package in SQL Server.
Create one job for execute the package.
Create one sp using SQL Server.
& execute the job.
using sp_start_job.
I think it solve ur problem.

Using dynamically named table in SSIS data flow task

I'm new to SSIS and am writing a package that includes moving data to a table that is created in a previous Execute SQL Task object.
The issue that I'm encountering is that I am unable to create a data flow destination task that uses a dynamic destination table name.
The intended process is:
Execute SQL Task object creates new table based on today's date (i.e. Table1_20111014)
Data Flow task moves data from table "Table1" to "Table1_20111014".
The column metadata for Table1 and Table1_20111014 are the same, and does not change. However, the name of the table the data needs to be moved to will change depending on the date at time of execution.
Is it possible to dynamically specify the destination table in a destination data flow object?
If not, are there known workarounds or is using SSIS for this task a bad idea?
As long as the meta data remains the same, there is no drawback to using dynamic destination table name.
To accomplish this, on the ole db destination instead of using "table name" or "table name fast load" use the equivalent "from variable" table load option. This obviously assumes you have a variable defined that contains the name of the table created in the execute sql task

Excel SSIS and SQL server

I want to develop an automation in SSIS.
Problem statement :
I have an excel sheet which has a single column.
Based on the values in that column (will be included as a search parameter in the SQL query) I need to fetch 2 or more columns from SQL server database
The results are to be stored in the same Excel sheet against the data obtained for that particular column.
I already have an excel macro for the same. But, now I want to develop a package for the same.
Please guide me through the necessary steps.
I will also keep trying to obtain the solution
Create an Excel Source and link it to your file
use a lookup component to perform a SQL select to obtain the missing data
Create an Excel destination to save your target data