I am using BIML and BIDSHelper to create SSIS package. I am trying to import data from csv to sql server. I want to create table in the destination database before the dataflow happens. Here is my code:
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<OleDbConnection Name="CM_OLE"
ConnectionString="Data Source=(localdb)\projects;Initial Catalog=test;Integrated Security=SSPI;Provider=SQLNCLI11">
</OleDbConnection>
<FlatFileConnection
Name="FF Source"
FileFormat="FFF Source"
FilePath="F:\test.csv"
CreateInProject="false" />
</Connections>
<FileFormats>
<FlatFileFormat
Name="FFF Source"
CodePage="1252"
RowDelimiter="CRLF"
ColumnNamesInFirstDataRow="true"
IsUnicode="false"
FlatFileType="Delimited"
TextQualifer="_x0022_"
HeaderRowsToSkip="0">
<Columns>
<Column Name="Column1" Length="50" InputLength="50" MaximumWidth="50" DataType="AnsiString" ColumnType="Delimited" CodePage="1252" Delimiter="," TextQualified="true" />
<Column Name="Column2" Precision="10" Scale="2" DataType="Decimal" ColumnType="Delimited" CodePage="1252" Delimiter="CRLF" TextQualified="true" />
</Columns>
</FlatFileFormat>
</FileFormats>
<Packages>
<Package ConstraintMode="Linear" Name="NumericParsingFromFlatFileInsertIdentity">
<Tasks>
<ExecuteSQL Name="Create table sometablename" ConnectionName="CM_OLE">
<DirectInput>
CREATE TABLE sometablename(column1 varchar(50) NOT NULL, column2 varchar(10,2) NOT NULL);
GO
</DirectInput>
</ExecuteSQL>
<Dataflow Name="DFT Source">
<Transformations>
<FlatFileSource ConnectionName="FF Source" Name="FF Source" />
<OleDbDestination ConnectionName="CM_OLE" Name="OLEDB DST">
<ExternalTableOutput Table="sometablename"></ExternalTableOutput>
</OleDbDestination>
</Transformations>
</Dataflow>
</Tasks>
</Package>
</Packages>
When I try to generate package it says cannot execute query select * from sometablename invalid object name
. I understand that table sometablename
doesnot exist so it throws the error. So, How could I create the table automatically? I have read the series BI Thoughts and Theories. Part 2 shows way to create table. My understanding is that at the end it also create ExecuteSQl to create the table. I am confused how to run table creation script before the dataflow or what other alternative BIML has to offer?
Thanks in advance