<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>PaulRizza</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/paulrizza/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/paulrizza/feed.xml</link>
    <description>Paul Rizza&amp;#039;s blog on SQL Server, SSRS and SSIS</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:12:04 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SSIS 2012 EzAPI - First Real Package (History Archive)</title>
      <link>https://docs.microsoft.com/archive/blogs/paulrizza/ssis-2012-ezapi-first-real-package-history-archive</link>
      <pubDate>Mon, 14 Jul 2014 23:17:00 GMT</pubDate>
      <dc:creator><![CDATA[Paul Rizza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/paulrizza/2014/07/14/ssis-2012-ezapi-first-real-package-history-archive/</guid>
      <description><![CDATA[This is the second in a series of Blog posts which will cover basic to advanced stages of SSIS...]]></description>
      <content:encoded><![CDATA[<p>This is the second in a series of Blog posts which will cover basic to advanced stages of SSIS package generation via EzAPI.&nbsp; In this post I will extend the project from the first Blog in the series and this time the packages will actually transfers data from one server to another.&nbsp;</p>
<h1>Project Description</h1>
<p>Often there is a need to move data from an application database to an archive database and if it was as simple as copying the entire table, it would be no problem and the wizard would provide what you need.&nbsp; But as the tables get larger, the idea of copying the entire table would present far too much load and delays on the source application database.&nbsp; So in this example we will create an SSIS project which copies data from the source database to the archive database based on a key column based on the max key value found in the archive database so only new records added since the prior run are added.&nbsp;</p>
<p><span style="font-size: x-small;"><em>(While this code will be close to complete there are some things which require additional consideration prior to using this code in a true production environment.)</em></span></p>
<h1><br />Prerequisites</h1>
<p><span style="font-size: small;"><span style="font-family: mceinline;">This blog assumes you followed and completed the first blog in this series "<a title="SSIS 2012 EzAPI - Basic Intro" href="http://blogs.msdn.com/b/paulrizza/archive/2014/07/14/ssis-2012-ezapi-basic-intro.aspx">SSIS 2012 EzAPI - Basic Intro</a>".&nbsp; If you have not completed that post you may have trouble following this post since this post assumes you are starting with the project as it is left in the prior post.</span></span></p>
<p>&nbsp;</p>
<h1>Database Setup</h1>
<p><span style="font-size: small;"><span style="font-family: mceinline;">In order to use the code in this blog you will need to create a table called&nbsp;TablesToArchive where we will get the list of tables to build into the SSIS packages and what the key column for each table will be.&nbsp; Scripts to create these examples can be found in the "Database and Table create scripts.sql" file included in the Zip for this blog.</span></span></p>
<h1><br />New C# Code</h1>
<p><span style="font-size: small;"><span style="font-family: mceinline;">In the last blog we just added all the code to the "Main" function, but since we will actually make real SSIS packages this time we will add new functions to make sure we code that is correct and readable.&nbsp; But we have a problem...In order to get only new data from the source database we need to look at the destination database to find the max prior key that we loaded.&nbsp; In order to do this, we need to use an ExecSQL task in SSIS and return the results to a variable so it can be used in a "Data Flow" task to filter the selected data.&nbsp; But the&nbsp;EzAPI code does not have the functions needed to return results from an ExecSQL task so we are going to need to add that first.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: mceinline;">On line 608 of&nbsp;"EzExecutables.cs" you need to add the following code so you can include&nbsp;result set bindings when dealing with EzExecSQL tasks.</span></span></p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">&nbsp; public</span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">IDTSResultBindings</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> ResultSetBindings</span></span></p>
<p>&nbsp;&nbsp; {</p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp; get</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> { </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">return</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> (host.InnerObject </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">as</span></span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">ExecuteSQLTask</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">).ResultSetBindings;}</span></span></p>
<p>&nbsp;&nbsp; }&nbsp;&nbsp;</p>
<p>And on Line 690 of the same file.</p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #000000; font-family: Arial;">&nbsp;&nbsp;&nbsp; </span>public</span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">bool</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> UseProjectReference</span></span></p>
<p>&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">get</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> { </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">return</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">bool</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">)host.Properties[</span></span><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;">"UseProjectReference"</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">].GetValue(host); }</span></span></p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #000000; font-family: Arial;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>set</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> { host.Properties[</span></span><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;">"UseProjectReference"</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">].SetValue(host, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">value</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">); }</span></span></p>
<p>&nbsp;&nbsp;&nbsp;}</p>
<p>Finally on&nbsp;line 1023 of "EzComponents.cs" you need to add the following code so you can use a variable as a source sql string for an OLEDBSource in a Dataflow task.</p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">&nbsp;&nbsp;public</span></span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">string</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> SqlCommandVar</span></span></p>
<p>&nbsp;&nbsp; {</p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp; get</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> { </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">return</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> (</span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">string</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">)m_meta.CustomPropertyCollection[</span></span><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;">"SqlCommand"</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">].Value; }</span></span></p>
<p><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">&nbsp;&nbsp;&nbsp;&nbsp; set</span></span></span>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">if</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;"> (AccessMode != </span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">AccessMode</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">.AM_SQLCOMMAND &amp;&amp; AccessMode != </span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">AccessMode</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">.AM_SQLCOMMAND_VARIABLE)</span></span> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_comp.SetComponentProperty(<span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;">"AccessMode"</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">, </span></span><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;"><span style="color: #2b91af; font-family: Consolas; font-size: x-small;">AccessMode</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">.AM_SQLCOMMAND_VARIABLE.GetHashCode());<br /></span></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_comp.SetComponentProperty(<span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;"><span style="color: #a31515; font-family: Consolas; font-size: x-small;">"SqlCommandVariable"</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">, </span></span><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;"><span style="color: #0000ff; font-family: Consolas; font-size: x-small;">value</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">); ReinitializeMetaData();</span></span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;</p>
<h1>Actual Console Project code</h1>
<p>&nbsp;</p>
<p>Next are the code changes required for the Console Project so we can create SSIS projects via EzAPI.</p>
<p>First, since I am starting with the project code from the first blog post I wanted to change a few things to make sure we don't keep building a project with the name "FirstEzAPISSISPackage.Exe" so I needed to right click on the Project and change a few names in the project properties menu.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1682.ProjectProps.PNG" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1682.ProjectProps.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1682.ProjectProps.PNG" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1682.ProjectProps.PNG" alt="" border="0" /></a></p>
<p>Next for some of the code we are adding you will need to make sure you add a reference to "Microsoft.SqlServer.SQLTask".&nbsp; This is done just like the step from the first Blog when we added the other references.</p>
<p>&nbsp;</p>
<pre class="scroll"><code class="csharp">using System;<br /> using System.Collections.Generic;<br /> using System.Linq;<br /> using System.Text;<br /> using System.Threading.Tasks;<br /> <br /> using Microsoft.SqlServer.Dts;<br /> using Microsoft.SqlServer.SSIS.EzAPI;<br /> <br /> <br /> namespace ArchiveEzAPIPackage<br /> {<br /> class ArchiveSSIS<br /> {<br /> static void Main(string[] args)<br /> {<br /> <br /> //Unlike in 2008R2 and earlier we start with a Project in SSIS now<br /> EzProject myEzAPIProject = new EzProject();<br /> <br /> //With EzAPI YOU ALWAYS WANT TO NAME EVERYTHING (if not you get a GUID for the name)<br /> myEzAPIProject.Name = "ArchiveDataProject";<br /> <br /> //now lets create a package which can be used to run all the other packages as one start point<br /> EzPackage MasterPackage = new EzPackage();<br /> <br /> //Dont forget to name the master package...<br /> MasterPackage.Name = "Archive Data Master Package";<br /> <br /> //Hard coding the source and Archive DB connections for now. This should be a parameter in a true package<br /> string SourceConnString = "Data Source=.\\SQL2k12;Initial Catalog=DemoSource;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;";<br /> string ArchiveConnString = "Data Source=.\\SQL2k12;Initial Catalog=DemoArchive;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;";<br /> <br /> <br /> //Create the connection and command to get the list of tables and loop through them<br /> string ListSourceConnString = "Data Source=.\\sql2k12;Initial Catalog=dba;Integrated Security=True;";<br /> string query = "SELECT [TableName], [KeyColumn], [KeyType] FROM [dbo].[TablesToArchive]";<br /> System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(ListSourceConnString);<br /> System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(query, conn);<br /> <br /> //Open the connection<br /> conn.Open();<br /> <br /> //create data adapter<br /> System.Data.SqlClient.SqlDataReader dr = cmd.ExecuteReader();<br /> <br /> //Loop through all the rows <br /> while (dr.Read())<br /> {<br /> //get the columns of data from the source list<br /> string TableName = dr["TableName"].ToString();<br /> string KeyColumn = dr["KeyColumn"].ToString();<br /> string KeyType = dr["KeyType"].ToString();<br /> <br /> //get a package reference with the archive package<br /> EzPackage ArchivePackage = CreateTransferPackage(TableName, KeyColumn, KeyType, SourceConnString, ArchiveConnString);<br /> <br /> //add that archive package to the Project<br /> myEzAPIProject.AddPackage(ArchivePackage);<br /> <br /> //now that the archive package is part of the project we need the master package to have an exec package task for it<br /> EzExecPackage exPack = new EzExecPackage(MasterPackage);<br /> exPack.PackageName = TableName.Replace("[", "").Replace("]", "").Replace(".", "").ToString() + ".dtsx";<br /> exPack.UseProjectReference = true;<br /> exPack.Name = TableName.Replace("[", "").Replace("]", "").Replace(".", "").ToString();<br /> <br /> }<br /> <br /> //Close the connection<br /> conn.Close();<br /> <br /> <br /> //Finally add your master package to the project<br /> myEzAPIProject.AddPackage(MasterPackage);<br /> <br /> //When you save the Project it saves the entire project in a single ISPAC file<br /> myEzAPIProject.SaveTo("c:\\SSIS\\ArchiveDataSSISProject.ispac");<br /> <br /> }<br /> <br /> static EzPackage CreateTransferPackage(string _tblName, string _KeyColumn, string _KeyColumnType, string _SourceConnString, string _ArchiveConnString)<br /> {<br /> EzPackage CTP = new EzPackage();<br /> <br /> //create a name for the package but in case <br /> // any "[" "]" "." characters are in the table name replace them<br /> // with an empty string.<br /> string SafeTableName = _tblName.Replace("[", "").Replace("]", "").Replace(".", "").ToString();<br /> CTP.Name = SafeTableName;<br /> <br /> <br /> //Add a connection to access the Source Database<br /> EzSqlOleDbCM srcConn = Activator.CreateInstance(typeof(EzSqlOleDbCM), new object[] { CTP }) as EzSqlOleDbCM;<br /> srcConn.ConnectionString = _SourceConnString;<br /> srcConn.Name = "SourceDB";<br /> <br /> //Add a connection to access the Archive Database<br /> EzSqlOleDbCM ArchiveConn = Activator.CreateInstance(typeof(EzSqlOleDbCM), new object[] { CTP }) as EzSqlOleDbCM;<br /> ArchiveConn.ConnectionString = _ArchiveConnString;<br /> ArchiveConn.Name = "ArchiveDB";<br /> <br /> //Based on the Type of Column the Key is create a Variable of that Type so it can store the max Key from the Archive<br /> if (_KeyColumnType.ToUpper() == "DATETIME")<br /> {<br /> CTP.Variables.Add("_MaxKey", false, "User", "1900-01-01 00:00:00:000");<br /> }<br /> else //we are only supporting Datetime and Int so far but this can easily be extended<br /> {<br /> CTP.Variables.Add("_MaxKey", false, "User", 0);<br /> }<br /> <br /> EzExecSqlTask GetMaxVal = new EzExecSqlTask(CTP);<br /> GetMaxVal.Connection = ArchiveConn;<br /> //make the string based on the KeyField Value from the Config Table because a few of the tables call RecoveryKey something else...<br /> //Note that this process does not support a composite key, only when a single key exists in a single column with this work without error or manual update<br /> <br /> if (_KeyColumnType.ToUpper() == "DATETIME")<br /> {<br /> GetMaxVal.SqlStatementSource = "Select convert(varchar, convert(datetime, isnull(Max(" + _KeyColumn + "), '1/1/1900 00:00:00:000')), 121) as recKey from " + _tblName;<br /> }<br /> else<br /> {<br /> GetMaxVal.SqlStatementSource = "Select isnull(Max(" + _KeyColumn + "), -1) as recKey from " + _tblName;<br /> }<br /> <br /> //Dont forget to name the ExecSQL task<br /> GetMaxVal.Name = "Get Max Key Value";<br /> <br /> //get the max recoveryKey value<br /> GetMaxVal.ResultSetType = Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultSetType.ResultSetType_SingleRow;<br /> GetMaxVal.ResultSetBindings.Add();<br /> Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.IDTSResultBinding resBin = GetMaxVal.ResultSetBindings.GetBinding(0);<br /> resBin.DtsVariableName = "User::_MaxKey";<br /> resBin.ResultName = "recKey";<br /> <br /> //Create a variable which will be the source of the DataFlow task<br /> Microsoft.SqlServer.Dts.Runtime.Variable sqlStr = CTP.Variables.Add("_SourceSQL", false, "User", "select * from " + _tblName + " with (nolock) where " + _KeyColumn + " &gt;= 0 ORDER BY " + _KeyColumn);<br /> sqlStr.EvaluateAsExpression = true;<br /> if (_KeyColumnType.ToUpper() == "DATETIME")<br /> {<br /> sqlStr.Expression = "\"select * from " + _tblName + " with (nolock) where " + _KeyColumn + " &gt; convert(datetime, '\" + (DT_WSTR, 50) @[User::_MaxKey] + \"') ORDER BY " + _KeyColumn + " \"";<br /> }<br /> else<br /> {<br /> sqlStr.Expression = "\"select * from " + _tblName + " with (nolock) where " + _KeyColumn + " &gt; \" + (DT_WSTR, 30) @[User::_MaxKey] + \" ORDER BY " + _KeyColumn + " \"";<br /> }<br /> <br /> //Create the dataflow task<br /> EzDataFlow dataFlow = new EzDataFlow(CTP);<br /> dataFlow.Name = "Move New Records";<br /> <br /> //Connect the dataflow task to the execSQL task<br /> dataFlow.AttachTo(GetMaxVal);<br /> <br /> //Create an OLEDbSource Connection which will use the Variable with max key <br /> EzOleDbSource source = Activator.CreateInstance(typeof(EzOleDbSource), new object[] { dataFlow }) as EzOleDbSource;<br /> source.Connection = srcConn;<br /> <br /> source.SqlCommandVar = "User::_SourceSQL";<br /> source.Name = "Source Data for " + SafeTableName;<br /> <br /> EzOleDbDestination dest = Activator.CreateInstance(typeof(EzOleDbDestination), new object[] { dataFlow }) as EzOleDbDestination;<br /> dest.Connection = ArchiveConn;<br /> dest.Table = _tblName;<br /> dest.AccessMode = AccessMode.AM_OPENROWSET_FASTLOAD;<br /> dest.FastLoadMaxInsertCommitSize = 10000;<br /> dest.FastLoadOptions = "ROWS_PER_BATCH = 10000";<br /> dest.Name = "Dest for " + SafeTableName;<br /> <br /> <br /> //Connect the source and Dest in the DataFlow task<br /> dest.AttachTo(source);<br /> <br /> <br /> //Return the Package to be added to the Project<br /> return CTP;<br /> }<br /> }<br /> }<br /> </code></pre>
<p>Don't worry,&nbsp;since there is a lot more code this time around, I am going to also include a Zip file with all the code samples zipped up to make life a little easier.</p>
<p>&nbsp;</p>
<h1>Testing and Results</h1>
<p>Once again when you build this project you will end up with an EXE file you need to run to get the IsPac project file but once you do, assuming you used the examples I built for this package you should have a project file that has 3 different packages in it.&nbsp; Since this is a more advanced package which may be worth taking a look at I am going to walk though how to get this ispac file in SSDT.&nbsp;</p>
<p>Step 1 is to Open Visual Studio <br /><em><span style="font-size: x-small;">(I am sorry for switching versions here but I had 2010 installed before 2012 was released so my 2012 SSIS packages are edited in 2010 which will be almost identical to 2012 and should be easy to jump back and forth).</span></em></p>
<p><span style="font-size: small;"><span>Select New Project then open the SSIS Project Type menu (Note this is not the SSIS option on the main Business Intelligence menu.&nbsp; You need to open it and select Integration Services to get the option we need).</span></span></p>
<p><span style="font-size: small;"><span>On the Integration Services menu you have 2 options (the import option is not on the main BI screen).</span></span></p>
<p><span style="font-size: small;"><span><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1832.NewProject.PNG" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1832.NewProject.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1832.NewProject.PNG" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1832.NewProject.PNG" alt="" border="0" /></a></span></span></p>
<p>Again you need to select the Import option.</p>
<p>&nbsp;</p>
<p>Once you select the import option you will get a menu much like what you see if you were going to deploy an ISPAC file.&nbsp; Select the ispac file created when you run the EXE file created by building the package then select next.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3107.importPackage.PNG" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3107.importPackage.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3107.importPackage.PNG" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3107.importPackage.PNG" alt="" border="0" /></a></p>
<p>Finally if there is no problem you will have a screen that confirms your import of the package into a new project.</p>
<p>Here is an example of the solution you will see if you used the scripts from this demo.</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/8284.Solutioncreatedbydemoproject.PNG" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/8284.Solutioncreatedbydemoproject.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/8284.Solutioncreatedbydemoproject.PNG" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/8284.Solutioncreatedbydemoproject.PNG" alt="" border="0" /></a></p>
<p>Finally, if you check any of the Archive table packages you will see identical layouts and the "Master" package a list of ExecPackage tasks for each archive package created by this process.&nbsp; Here is an example of one of each type</p>
<p>(Master is on top and one of the archive packages on the bottom).</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6014.packageexamples.PNG" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6014.packageexamples.PNG"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6014.packageexamples.PNG" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6014.packageexamples.PNG" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/54/23/51/DemoCode.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-54-23-51/DemoCode.zip">DemoCode.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>SSIS 2012 EzAPI - Basic Intro</title>
      <link>https://docs.microsoft.com/archive/blogs/paulrizza/ssis-2012-ezapi-basic-intro</link>
      <pubDate>Mon, 14 Jul 2014 20:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Paul Rizza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/paulrizza/2014/07/14/ssis-2012-ezapi-basic-intro/</guid>
      <description><![CDATA[Since the upgrade from 2008R2 to 2012 with the addition of Project based package setups I never...]]></description>
      <content:encoded><![CDATA[<p>Since the upgrade from 2008R2 to 2012 with the addition of Project based package setups I never found many blog entries and so far nothing that clearly shows the basic setup of a project.&nbsp; So in this (which I hope to make the first of many blog entries I am going to cover the basic setup of an EzAPI project.</p>
<h1>Setup (Download and Build EzAPI)</h1>
<p>First thing you are going to need to do is download the Source Code for EzAPI (SSIS 2012 version).</p>
<p>Instead of downloading the installer I prefer to download just the source code so I can include it as a project reference when setting up my project to create packages.&nbsp; So we will start by going to <a href="http://sqlsrvintegrationsrv.codeplex.com/SourceControl/latest">http://sqlsrvintegrationsrv.codeplex.com/SourceControl/latest</a></p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/0702.image001.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/0702.image001.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/0702.image001.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/0702.image001.png" alt="" width="582" height="223" border="0" /></a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>From here you can click on the Main section in the lower left menu to expand the grouping.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/4572.image003.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/4572.image003.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/4572.image003.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/4572.image003.png" alt="" border="0" /></a></p>
<p>While &ldquo;main&rdquo; is selected, click on the &ldquo;Download&rdquo; link.</p>
<p>This should download &ldquo;sqlsrvintegrationsrv-100610.zip&rdquo; <br /><em><span style="font-size: x-small;">(Note that if a new version has been released for a later version of SQL Server you need to make sure you download the history version for 2012 to follow this guide).</span></em></p>
<p>Extract all the files in the Zip file so you can open a project to begin working with EzAPI.</p>
<p>Inside the Zip file is 2 folders that look like this:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/8446.image005.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/8446.image005.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/8446.image005.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/8446.image005.png" alt="" border="0" /></a></p>
<p>Open the &ldquo;main&rdquo; folder, then &ldquo;EzAPI&rdquo; folder and finally the &ldquo;src&rdquo; folder.</p>
<p>You should now be in the &ldquo;src&rdquo; folder and it should look like this:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1460.image006.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1460.image006.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/1460.image006.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/1460.image006.png" alt="" border="0" /></a></p>
<p>Now you can open the &ldquo;EzAPI.csproj&rdquo; file starting a new project in Visual Studio 2012.</p>
<p>Before moving any farther you should make sure you can &ldquo;Build&rdquo; the solution to make sure you have the references required for the project to compile.&nbsp;</p>
<p>&nbsp;</p>
<h1>Creating your first EzAPI based package/SSIS project</h1>
<p><br /><br />Once the project has been successfully built EzAPI you can move on to creating your first SSIS Project.</p>
<p>In this case &ldquo;Right Click&rdquo; on the Solution and select Add -&gt; New Project</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/0523.image008.jpg" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/0523.image008.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/0523.image008.jpg" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/0523.image008.jpg" alt="" border="0" /></a></p>
<p>Then select &ldquo;Visual C#&rdquo; -&gt; &ldquo;Windows&rdquo; -&gt; &ldquo;Console Application&rdquo;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6735.image009.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6735.image009.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6735.image009.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6735.image009.png" alt="" border="0" /></a></p>
<p>(Don&rsquo;t forget to give the project a name.&nbsp; I used &ldquo;FirstEzAPIPackage&rdquo; for this example.)</p>
<p>&nbsp;</p>
<p>While the new project is selected you want to make sure you add references to the following DLLs from the .Net tab.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/2804.image010.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/2804.image010.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/2804.image010.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/2804.image010.png" alt="" border="0" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3201.image012.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3201.image012.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3201.image012.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3201.image012.png" alt="" border="0" /></a></p>
<p>Microsoft.SqlServer.DTSRuntimeWrap<br /><br />Microsoft.SqlServer.ManagedDTS</p>
<p>&nbsp;</p>
<p>Now so we can use EzAPI but also add new features in later blog posts we will add a Reference to the copy in our Solution.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6825.image014.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6825.image014.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6825.image014.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6825.image014.png" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<p>Now we add the Code to the program file in the project.</p>
<pre class="scroll"><code class="csharp"> using System;<br /> using System.Collections.Generic;<br /> using System.Linq;<br /> using System.Text;<br /> using System.Threading.Tasks;<br /> <br /> using Microsoft.SqlServer.Dts;<br /> using Microsoft.SqlServer.SSIS.EzAPI;<br /> <br /> <br /> namespace FirstEzAPIPackage<br /> {<br /> class Program<br /> {<br /> static void Main(string[] args)<br /> {<br /> <br /> //Unlike in 2008R2 and earlier we start with a Project in SSIS now<br /> EzProject myEzAPIProject = new EzProject();<br /> <br /> //With EzAPI YOU ALWAYS WANT TO NAME EVERYTHING (if not you get a GUID for the name)<br /> myEzAPIProject.Name = "MyFirstEzAPISSISProject";<br /> <br /> //now lets create 2 empty packages just to see an example of the process<br /> EzPackage FirstEzAPIPackage = new EzPackage();<br /> EzPackage SecondEzAPIPackage = new EzPackage();<br /> <br /> //Dont forget to name them...<br /> FirstEzAPIPackage.Name = "FirstPackage";<br /> SecondEzAPIPackage.Name = "SecondPackage";<br /> <br /> <br /> //One of the last steps you take is to add your packages to your project<br /> myEzAPIProject.AddPackage(FirstEzAPIPackage);<br /> myEzAPIProject.AddPackage(SecondEzAPIPackage);<br /> <br /> <br /> //When you save the Project it saves the entire project in a single ISPAC file<br /> myEzAPIProject.SaveTo("c:\\SSIS\\FirstEzAPISSISProject.ispac");<br /> <br /> }<br /> }<br /> }<br /> <br /></code></pre>
<h1>Final steps &ndash; Compile and Test</h1>
<p>&nbsp;</p>
<p>Save your changes, then Build the new project.</p>
<p>In the last line of the code we setup the project to save to &ldquo;C:\SSIS\&rdquo; folder.&nbsp; So you need to make sure you have an SSIS folder off the C drive (or change that path in the code) prior to compiling and running your code.</p>
<p>Once your project is built you need to remember that you don&rsquo;t have the IsPac project file created yet.&nbsp; The Build compiles the Console Application you just created into a .EXE file.&nbsp; If you look at the second to last line of the &ldquo;Output&rdquo; screen you can copy the full path to your .EXE file so you can run the code to test it out.</p>
<p>In this case we didn&rsquo;t add any parameters, so just open the command prompts and run the file.</p>
<p>We also didn&rsquo;t add any output yet so a few seconds later it should complete without printing anything.</p>
<p>Now if we open the C:\SSIS folder we should have a new .IsPac file named &ldquo;FirstEzAPISSISProject.ispac&rdquo;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/5584.image016.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/5584.image016.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/5584.image016.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/5584.image016.png" alt="" border="0" /></a><br />&nbsp;<br />If you want to check the contents you can either load the package into SSDT, deploy the code to an SSIS server or take the shortcut and just check the contents.&nbsp; If you change the IsPac file type to a .Zip instead you can actually open the file and see that it has 2 packages and some config/parameter files inside just like any other compiled SSIS project should.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/7875.image017.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/7875.image017.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/7875.image017.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/7875.image017.png" alt="" border="0" /></a></p>
<h1>Next Steps</h1>
<p>In the next blog entry I will be actually making the packages from this example do something then in future versions look into adding Project level parameters to show configuration options added with SSIS 2012.&nbsp; If there are specific features you would like to see in a future blog please leave a comment here.</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Entry 2: (SSIS) Intro to EzAPI</title>
      <link>https://docs.microsoft.com/archive/blogs/paulrizza/entry-2-ssis-intro-to-ezapi</link>
      <pubDate>Sun, 02 Jun 2013 07:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Paul Rizza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/paulrizza/2013/06/02/entry-2-ssis-intro-to-ezapi/</guid>
      <description><![CDATA[Paul Rizza&rsquo;s T-SQL, SSIS and SSRS Blog
The blog is actually the intro to a class I teach...]]></description>
      <content:encoded><![CDATA[<div class="WordSection1">
<h1 class="MsoTitle"><span class="MsoBookTitle">Paul Rizza&rsquo;s T-SQL, SSIS and SSRS Blog</span></h1>
<p class="MsoNormal">The blog is actually the intro to a class I teach for SQL Saturdays for PASS (Professional Association for SQL Server) called &ldquo;Shortcuts to SSIS via Dot Net&rdquo;.<span style="mso-spacerun: yes;">&nbsp; </span>In that class I cover the basics of getting started building your first package via the SSIS API Libraries.<span style="mso-spacerun: yes;">&nbsp; </span>In the Blog I am going to go into the detail I can&rsquo;t cover on the screen in that class.<span style="mso-spacerun: yes;">&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;</span></p>
<h1>Background:</h1>
<p class="MsoNormal">Each time someone new to SSIS starts to work with the tool the first thing they notice is that the SSIS packages are really just a complex XML document.<span style="mso-spacerun: yes;">&nbsp; </span>Then they start to think how easily they could use a quick program to pump out the packages they need with the minor metadata changes covered by the script.<span style="mso-spacerun: yes;">&nbsp; </span>Then they may even go the one step farther and find that all of the SSIS development tools that Microsoft provides are actually just interfacing with the SSIS API libraries, so if their code can just interface with those libraries they are one step closer to home.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">Then they start actually trying to develop this code, or extend a package using the API libraries.<span style="mso-spacerun: yes;">&nbsp; </span>Depending on the background and abilities of the developer going down this path, the next few days to 3 weeks normally has an almost identical story.<span style="mso-spacerun: yes;">&nbsp; </span>They try to find documentation and examples of how to build even a simple package, and they learn it doesn&rsquo;t really exist.<span style="mso-spacerun: yes;">&nbsp; </span>Then they start to try to work with the code directly and run into roadblock after roadblock.<span style="mso-spacerun: yes;">&nbsp; </span>After the normal amount of time has passed and they have exactly ZERO work to show for the efforts they admit that the development tools from Microsoft are actually doing a lot of steps behind the scenes.<span style="mso-spacerun: yes;">&nbsp; </span>From the GUI you draw a line for your source object to your destination object and a few seconds later you have source to destination mapped in a transform.<span style="mso-spacerun: yes;">&nbsp; </span>What may not have been clear was when they drew that simple line, SQL Server Data Tools [SSDT] (the new replacement for BIDS in SQL Server 2012) actually just got the metadata for all the columns (Source and Destination), tested them to see they can be mapped (not putting a VARCHAR data string into a DateTime), and setting all the default transformation properties.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">This problem of needing to do all the steps that SSDT did for you in the code <span class="GramE">is</span> exactly where EzAPI can step in and shine.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<h1>What is <span class="GramE">EzAPI:</span></h1>
<p class="MsoNormal">EzAPI started as a support DLL used by members of the SSIS development team to test new API&rsquo;s as they are coded without the need to spend time looping them into SSDT just to test the one new feature.<span style="mso-spacerun: yes;">&nbsp; </span>Once they were using it all the time, someone had the great idea that if it was helping the SSIS development team, then maybe it could help actual SSIS users.<span style="mso-spacerun: yes;">&nbsp; </span>As a codeplex Project EzAPI is not officially supported by Microsoft, but I will say that for now the SSIS development team still seems to be releasing updates to the code.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">EzAPI&rsquo;s base DLL and the source code (C#) that generates that code can be found at <a href="http://sqlsrvintegrationsrv.codeplex.com/">http://sqlsrvintegrationsrv.codeplex.com/</a></p>
<p class="MsoNormal">Please note that if you are looking to download the code and samples, but do not want to use SQL Server 2012 (or whatever version is the latest as you read this document) you want to check the release notes carefully.<span style="mso-spacerun: yes;">&nbsp; </span>The 2008R2 version for example was last stable in the release tagged with Change Set 65381.<span style="mso-spacerun: yes;">&nbsp; </span>You can find the notes I am referring to by following the steps in the image below:</p>
<p class="MsoNormal"><span style="mso-no-proof: yes;"> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3124.image001.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3124.image001.png"><img style="border: 0px currentColor;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/3124.image001.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/3124.image001.png" alt="Screen shot of the CodePlex page where EzAPI sourcecode can be downloaded." width="1036" height="260" /></a></span></p>
<p class="MsoNormal">&nbsp;</p>
<h1>Wait, my client does not want custom code or DLLs on the Production SQL or SSIS Servers</h1>
<p class="MsoNormal">Here is where EzAPI can really shine.<span style="mso-spacerun: yes;">&nbsp; </span>If used correctly, the results of using the tool is an SSIS package, with no need to install the EzAPI DLL anywhere except your own DEV machine so it can spit out more SSIS packages.<span style="mso-spacerun: yes;">&nbsp; </span>There is only one minor difference between the package made with EzAPI and the ones made with SSDT.<span style="mso-spacerun: yes;">&nbsp; </span>Specifically, packages that are made programmatically (either with EzAPI, the root SSIS DLLs or any other tool) all lack a package layout definition.<span style="mso-spacerun: yes;">&nbsp; </span>The layout is what tells SSDTs that TaskA needs to be 113 pixels to the left and 64 pixels below TaskB.<span style="mso-spacerun: yes;">&nbsp; </span>At runtime the layout is ALMOST useless.<span style="mso-spacerun: yes;">&nbsp; </span>I say almost because there are some 3<sup>rd</sup> <span class="GramE">party</span> logging tools that use the layout definition to help mock a SSIS package as though it was being run in debug mode.<span style="mso-spacerun: yes;">&nbsp; </span>One of those tools is called BiExpress.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">The good news is that if you made your packages programmatically, but now need a Package Layout added to the SSIS package, you can open the SSIS package in SSDTs, move any single object 1 pixel to the left/right/top/bottom and it will then generate a package layout for the next time you save the package.<span style="mso-spacerun: yes;">&nbsp; </span>If you open the package in a text editor, you can normally see the Layout information because it does not have the same use of XML (the XML is broken into code since it is code within code).<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">Layout Code in the Text Editor:</p>
<p class="MsoNormal"><span style="mso-no-proof: yes;">&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6874.image003.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6874.image003.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6874.image003.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6874.image003.png" alt="" border="0" /></a></span></p>
<p class="MsoNormal">SSIS Code in the Text Editor:</p>
<p class="MsoNormal"><span style="mso-no-proof: yes;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6825.image005.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6825.image005.png"><img style="border: 0px currentColor;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/6825.image005.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/6825.image005.png" alt="Normal XML for SSIS Code" width="870" height="106" /></a></span></p>
<p class="MsoNormal">As you can see the SSIS code is cleaner, the Layout uses a lot of break out characters.</p>
<h2>Getting EzAPI Started:</h2>
<p class="MsoNormal">First thing you need to note.<span style="mso-spacerun: yes;">&nbsp; </span>This is C# programming, not SSIS, so if you do not have the C# project type, you are not going to proceed past this point without getting visual studio and the C# project type.<span style="mso-spacerun: yes;">&nbsp; </span><br /> For this example I am going to work with SSIS on SQL 2008R2, using Visual Studio 2010.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal">I am going to start by opening the Solution in the PaulRizza-BlogEntry2.Zip file from this blog.<span style="mso-spacerun: yes;">&nbsp; </span>This example Solution has the 3 projects that I cover in my basic 1 hour PASS class.<span style="mso-spacerun: yes;">&nbsp; </span>Specifically, this zip file contains the 3 project:<br />&nbsp;<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/4336.image007.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/4336.image007.png"><img style="border: 0px currentColor; float: left;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/58/66/4336.image007.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-58-66/4336.image007.png" alt="Screen shot of the Solution Explorer for the Included Visual Studio 2010 Solution" width="219" height="322" /></a></p>
<p class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in; mso-list: l1 level1 lfo1;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">1.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>A simple project that generates a very simple first package so you can get the hang of using EzAPI</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; mso-list: l1 level1 lfo1;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">2.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>The EzAPI source code that complies into the EzAPI DLL so it can be using and referenced in the other project types</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in; mso-list: l1 level1 lfo1;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">3.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>A complex package starting to show all the functionality that EzAPI has to offer</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpMiddle">&nbsp;</p>
<p class="MsoListParagraphCxSpLast">&nbsp;</p>
<h1><span style="mso-fareast-font-family: 'Times New Roman';">Adding RowCount as an EzAPI Component:</span></h1>
<p class="MsoNormal"><span style="mso-fareast-font-family: 'Times New Roman';">Since EzAPI extends the default SSIS API library, any of the default components can be inherited and used by the EzAPI Class.<span style="mso-spacerun: yes;">&nbsp; </span>In this case, if you search the EzAPI project for the string &ldquo;//DEMO&rdquo; you will example code where I extended EzAPI to include the SSIS RowCount Component.&nbsp; In this case, the code that I am showing below was added to the EzComponents.cs file so the SSIS package generation programs were able to also build out RowCount components in the SSIS packages.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">//DEMO</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>[<span class="GramE"><span style="color: #2b91af;">CompID</span>(</span><span style="color: #a31515;">"{150E6007-7C6A-4CC3-8FF3-FC73783A972E}"</span>)]</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">public</span></span> <span style="color: blue;">class</span> <span style="color: #2b91af;">EzRowCount</span> : <span style="color: #2b91af;">EzComponent</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">public</span></span> EzRowCount(<span style="color: #2b91af;">EzDataFlow</span> dataFlow) : <span style="color: blue;">base</span>(dataFlow) { }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">public</span></span> EzRowCount(<span style="color: #2b91af;">EzDataFlow</span> parent, <span style="color: #2b91af;">IDTSComponentMetaData100</span> meta) : <span style="color: blue;">base</span>(parent, meta) { }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">public</span></span> <span style="color: blue;">string</span> VariableName</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">get</span></span> { <span style="color: blue;">return</span> (<span style="color: blue;">string</span>)m_meta.CustomPropertyCollection[<span style="color: #a31515;">"VariableName"</span>].Value; }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">set</span></span> { m_comp.SetComponentProperty(<span style="color: #a31515;">"VariableName"</span>, <span style="color: blue;">value</span>); }</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal"><span style="mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal"><span style="mso-fareast-font-family: 'Times New Roman';">The hardest part is finding the CompID which is a 16 byte GUID that correctly References the SSIS API Component ID.<span style="mso-spacerun: yes;">&nbsp; </span>In my case, I selected the GUI from a component that was already there, <span class="GramE">then</span> used BING.Com to find a larger list that included most of the Components that add not be set.<span style="mso-spacerun: yes;">&nbsp; </span>In my case, it was "{150E6007-7C6A-4CC3-8FF3-FC73783A972E}" that I was looking for.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<p class="MsoNormal"><span style="mso-fareast-font-family: 'Times New Roman';">In addition, the Row Count control only has 1 setting, which is the Variable that stores the current count so it can be used later in the package.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<h1>Building that first package (SimplePackage Project from the zip file):</h1>
<p class="MsoNormal">I am going to walk through each section of the code and example what that section does.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">static</span></span> <span style="color: blue;">void</span> Main(<span style="color: blue;">string</span>[] args)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//handle command line items</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_PackageName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_SourceServerName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_SourceDBName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_DestServerName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_DestDBName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">string</span></span> _CL_TableName = <span style="color: #a31515;">" "</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">if</span></span> (args.Count() == 0)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_PackageName = <span style="color: #a31515;">"SimplePackageExample"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_SourceServerName = <span style="color: #a31515;">"Localhost\\sql2k8r2"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_SourceDBName = <span style="color: #a31515;">"DemoSource"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_DestServerName = <span style="color: #a31515;">"Localhost\\sql2k8r2"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_DestDBName = <span style="color: #a31515;">"DemoDest"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_TableName = <span style="color: #a31515;">"Delta.Example1"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">else</span></span> <span style="color: blue;">if</span> (args.Count() != 6)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: #2b91af;">Console</span>.WriteLine(</span><span style="color: #a31515;">"Invalid Command Line Format"</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="GramE"><span style="color: #2b91af;">Console</span>.WriteLine(</span><span style="color: #a31515;">"Usage: "</span> + System.<span style="color: #2b91af;">AppDomain</span>.CurrentDomain.FriendlyName.ToString() + <span style="color: #a31515;">" {PackageName} {SourceServerName} {SourceDatabaseName} {DestServerName} {DestDatabaseName} {TableName}"</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">System.<span style="color: #2b91af;">Environment</span>.Exit(</span>-1);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE"><span style="color: blue;">else</span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//handle comand line items</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_PackageName = <span class="GramE">args[</span>0];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_SourceServerName = <span class="GramE">args[</span>1];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_SourceDBName = <span class="GramE">args[</span>2];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_DestServerName = <span class="GramE">args[</span>3];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_DestDBName = <span class="GramE">args[</span>4];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>_CL_TableName = <span class="GramE">args[</span>5];</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;">This class is setup so that when it is run from the command line, different parameters can be passed which result in different packages being produced.<span style="mso-spacerun: yes;">&nbsp; </span>Each parameter is fairly self-explanatory but just in case here is the quick rundown:</p>
<p class="MsoListParagraphCxSpFirst" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">1.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_PackageName = the name you want to use for the package at runtime, as well as the filename.<span style="mso-spacerun: yes;">&nbsp; </span>Note that the filename will also include the TableName (As defined in a later command line variable) being transferred.</p>
<p class="MsoListParagraphCxSpMiddle" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">2.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_SourceServerName = the Server name where the data is coming from.</p>
<p class="MsoListParagraphCxSpMiddle" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">3.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_SourceDBName = the database name where the data is coming from.</p>
<p class="MsoListParagraphCxSpMiddle" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">4.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_DestServerName = The Server name where the data is going too.</p>
<p class="MsoListParagraphCxSpMiddle" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">5.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_DestDBName = <span class="GramE">The</span> database name where the data is going too.</p>
<p class="MsoListParagraphCxSpLast" style="line-height: normal; text-indent: -0.25in; margin-bottom: 0pt; mso-list: l0 level1 lfo2; mso-layout-grid-align: none; mso-add-space: auto;"><span style="mso-fareast-font-family: Calibri;"><span style="mso-list: Ignore;">6.<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span>_CL_TableName = <span class="GramE">The</span> name of the table where the data is coming from, as well as the name of the destination table.<span style="mso-spacerun: yes;">&nbsp; </span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">As I am going through the code you may also notice that each time a new control is added, one of the very first steps is to give that component a name since this makes sure the name is not defaulted to the GUID ID of that component.<span style="mso-spacerun: yes;">&nbsp; </span>The code also defaults the parameters in the event nothing is passed.<span style="mso-spacerun: yes;">&nbsp; </span>This is done to make it easy if you wanted to run a quick test without doing a compile then typing out the command line. </span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">Creating a new package then giving it a package name.<span style="mso-spacerun: yes;">&nbsp; </span>Setting the name is very important since without the name the log file will just so the GUID and will be very hard to read correctly.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">// <span class="GramE">Creating</span> the package and the Data Flow Task:</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzPackage</span> package = <span style="color: blue;">new</span> <span class="GramE"><span style="color: #2b91af;">EzPackage</span>(</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>package.Name = _CL_PackageName;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">This next section creates the 2 connections in the connection manager and sets them up based on the command line parameters.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">// <span class="GramE">Creating</span> a connection to the database:</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzSqlOleDbCM</span> srcConn = <span class="GramE"><span style="color: #2b91af;">Activator</span>.CreateInstance(</span><span style="color: blue;">typeof</span>(<span style="color: #2b91af;">EzSqlOleDbCM</span>), <span style="color: blue;">new</span> <span style="color: blue;">object</span>[] { package }) <span style="color: blue;">as</span> <span style="color: #2b91af;">EzSqlOleDbCM</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzSqlOleDbCM</span> destConn = <span class="GramE"><span style="color: #2b91af;">Activator</span>.CreateInstance(</span><span style="color: blue;">typeof</span>(<span style="color: #2b91af;">EzSqlOleDbCM</span>), <span style="color: blue;">new</span> <span style="color: blue;">object</span>[] { package }) <span style="color: blue;">as</span> <span style="color: #2b91af;">EzSqlOleDbCM</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">srcConn.SetConnectionString(</span>_CL_SourceServerName, _CL_SourceDBName);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>srcConn.Name = <span style="color: #a31515;">"SourceDB"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">destConn.SetConnectionString(</span>_CL_DestServerName, _CL_DestDBName);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>destConn.Name = <span style="color: #a31515;">"DestDB"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="font-family: Consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="font-family: Consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">This section creates <span class="GramE">a</span> ExecuteSQL task that deletes data from the table Delta.Example1</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// need to add a step to delete from the DEST before we load the data</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #2b91af;">EzExecSqlTask</span> DelDest = <span style="color: blue;">new</span> <span class="GramE"><span style="color: #2b91af;">EzExecSqlTask</span>(</span>package);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>DelDest.Name = <span style="color: #a31515;">"Delete Dest Data"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>DelDest.Connection = destConn;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>DelDest.SqlStatementSource = <span style="color: #a31515;">"Delete from Delta.Example1"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">Next we add a data flow.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzDataFlow</span> dataFlow = <span style="color: blue;">new</span> <span class="GramE"><span style="color: #2b91af;">EzDataFlow</span>(</span>package);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>dataFlow.Name = <span style="color: #a31515;">"SimplePackageDataTransformStep"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">The <span class="GramE">AttachTo(</span>) function (outside of a dataflow) defaults to a On Success Flow connection.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">dataFlow.AttachTo(</span>DelDest);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="font-family: Consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">This next section adds a Source connection to the Dataflow and uses the command line table as the data source and destination.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//add conns to dataflow</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzOleDbSource</span> source = <span class="GramE"><span style="color: #2b91af;">Activator</span>.CreateInstance(</span><span style="color: blue;">typeof</span>(<span style="color: #2b91af;">EzOleDbSource</span>), <span style="color: blue;">new</span> <span style="color: blue;">object</span>[] { dataFlow }) <span style="color: blue;">as</span> <span style="color: #2b91af;">EzOleDbSource</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>source.Connection = srcConn;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>source.Name = <span style="color: #a31515;">"Source"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>source.Table = _CL_TableName;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">If instead of a table as the source, you wanted to use a SQL statement, Source.Table above would be replaced by Source.SQLCommand example below.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//source.SqlCommand = "select * from table1";</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">In this code the Destination is added to the Dataflow and again based on the command line table name.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">EzOleDbDestination</span> Dest = <span class="GramE"><span style="color: #2b91af;">Activator</span>.CreateInstance(</span><span style="color: blue;">typeof</span>(<span style="color: #2b91af;">EzOleDbDestination</span>), <span style="color: blue;">new</span> <span style="color: blue;">object</span>[] { dataFlow }) <span style="color: blue;">as</span> <span style="color: #2b91af;">EzOleDbDestination</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Dest.Connection = destConn;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Dest.Name = <span style="color: #a31515;">"Destination"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="mso-fareast-font-family: 'Times New Roman';">AttachTo also has the option to support multiple input sources (like would be used on a Union ALL), or multiple outbound sources (like in a multicast).<span style="mso-spacerun: yes;">&nbsp; </span><span class="GramE">AttachTo(</span>{SourceToAttachTo, IndexOfOutbound, IndexOfInbound)</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">Dest.AttachTo(</span>source, 0, 0);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Dest.Table = _CL_TableName;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Dest.AccessMode = <span style="color: #2b91af;">AccessMode</span>.AM_OPENROWSET_FASTLOAD;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">Dest.SetComponentProperty(</span><span style="color: #a31515;">"FastLoadMaxInsertCommitSize"</span>, 100000);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="font-family: Consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="mso-fareast-font-family: 'Times New Roman';">This next to last section is used to configure the package configurations which would be used to inherit configuration settings from the parent package calling this child package.</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//Package Configs</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>package.EnableConfigurations = <span style="color: blue;">true</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//new config to edit</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Configuration</span> MyConfigSource = <span class="GramE">package.Configurations.Add(</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigSource.Name = <span style="color: #a31515;">"SourceDBConfig"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigSource.ConfigurationType = <span style="color: #2b91af;">DTSConfigurationType</span>.ParentVariable;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigSource.ConfigurationString = <span style="color: #a31515;">"Copy_SourceDB"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigSource.PackagePath = <span style="color: #a31515;">"\\<span class="GramE">Package.Connections[</span>SourceDB].Properties[ConnectionString]"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #2b91af;">Configuration</span> MyConfigDest = <span class="GramE">package.Configurations.Add(</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigDest.Name = <span style="color: #a31515;">"DestDBConfig"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigDest.ConfigurationType = <span style="color: #2b91af;">DTSConfigurationType</span>.ParentVariable;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigDest.ConfigurationString = <span style="color: #a31515;">"Copy_DestDB"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>MyConfigDest.PackagePath = <span style="color: #a31515;">"\\<span class="GramE">Package.Connections[</span>DestDB].Properties[ConnectionString]"</span>;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="font-family: Consolas; font-size: 9.5pt;">&nbsp;</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"><span style="mso-fareast-font-family: 'Times New Roman';">Finally Save the package as a .DTSX <span class="GramE">file</span>, or executed if this was a runtime package only</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//save the package</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="GramE">package.SaveToFile(</span><span style="color: #a31515;">".\\PackageOutput\\"</span> + _CL_PackageName + <span style="color: #a31515;">"_"</span> + tableNameWithoutSchema + <span style="color: #a31515;">".dtsx"</span>);</span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';"><span style="mso-spacerun: yes;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: green;">//<span class="GramE">package.Execute(</span>);</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="color: green; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: 'Times New Roman';">&nbsp;</span></p>
<h1><span style="mso-fareast-font-family: 'Times New Roman';">Next Time&hellip;</span></h1>
<p class="MsoNormal"><span style="mso-fareast-font-family: 'Times New Roman';">In the next SSIS Blog, I will review the details of the Complex Package just like I did for the Simple Package today.<span style="mso-spacerun: yes;">&nbsp; </span></span></p>
<h1><span style="mso-fareast-font-family: 'Times New Roman';">Comments, Questions and Requests:</span></h1>
<p class="MsoNormal">I know this is a very simple SSIS package for the Blog entry, but it is a basis which will become the foundation for much more complex packages.&nbsp; Please feel free to post comments, leave questions or add requests, and I will do my best to address them as time permits. &nbsp;</p>
</div>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/42/29/23/EzAPI%20-%20DOTNet%20Source.zip" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-42-29-23/EzAPI-_2D00_-DOTNet-Source.zip">EzAPI - DOTNet Source.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Entry 1: (T-SQL) Where it all Begins</title>
      <link>https://docs.microsoft.com/archive/blogs/paulrizza/entry-1-t-sql-where-it-all-begins</link>
      <pubDate>Mon, 27 May 2013 12:25:00 GMT</pubDate>
      <dc:creator><![CDATA[Paul Rizza]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/paulrizza/2013/05/27/entry-1-t-sql-where-it-all-begins/</guid>
      <description><![CDATA[Paul Rizza&rsquo;s T-SQL, SSIS and SSRS Blog
Many of my clients and the students in my classes for...]]></description>
      <content:encoded><![CDATA[<h1 class="MsoTitleCxSpFirst">Paul Rizza&rsquo;s T-SQL, SSIS and SSRS Blog</h1>
<p class="MsoNormal">Many of my clients and the students in my classes for SQL Pass SQLSaturday sessions often ask if I have a blog where I post more information, so I decided I should go ahead and start one.&nbsp;</p>
<p class="MsoNormal">Since many of my future blog posts will be on T-SQL I decided to make this first blog a very simple one, where I can store the setup for the database I will run future code, &nbsp;as well as store some of the common items I will need for those future entries.</p>
<h1>My background:</h1>
<p class="MsoNormal">I have been working with SQL Server since version 6.5.&nbsp; For the last 13 years I have been working as a Consultant, most recently for Microsoft Corporation.&nbsp; I also started with DTS in SQL 2000, and moved to SSIS in SQL 2005.&nbsp; Many of my SSIS based postings will also include C# code that makes use of a set of DLLs called EzAPI.&nbsp; EzAPI is a code wrapper for the SSIS DLLs that helps to produce SSIS packages in C# code without as much effort (saving 100s of hours in many cases).</p>
<h1>Topic requests:</h1>
<p class="MsoNormal">While I will do my best to post Blog entries on the topics I get feedback requesting, I am limited to the topics I have time to fully research.&nbsp; In many cases that limitation of time is driven by my current assignments for my current clients at Microsoft.&nbsp; If there is something you would like to see in more detail please leave a comment and I will do my best to cover it in a later post, but I cannot promise to cover everything.&nbsp;</p>
<h1>Getting Started:</h1>
<p class="MsoNormal">This first script will create the database where I will keep and run all of my future blog posts:</p>
<div style="border: none; padding: 0in 0in 4.0pt 0in; margin-left: .65in; margin-right: .65in;">
<h3 class="MsoIntenseQuote" style="margin-top: 10.0pt; margin-right: 0in; margin-bottom: 14.0pt; margin-left: 0in;">Create BlogDB Database</h3>
</div>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">USE</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: teal;">[master]</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">GO</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: green;">/****** Object:&nbsp; Database [BlogDB]&nbsp;&nbsp;&nbsp; Script Date: 5/27/2013 2:10:12 PM ******/</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">CREATE</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">DATABASE</span> <span style="color: teal;">[BlogDB]</span> <span style="color: blue;">ON</span>&nbsp; <span style="color: blue;">PRIMARY</span> </span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: gray;">(</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: teal;">NAME</span> <span style="color: gray;">=</span> <span style="color: red;">N'BlogDB'</span><span style="color: gray;">,</span> <span style="color: blue;">FILENAME</span> <span style="color: gray;">=</span> <span style="color: red;">N'C:\MSSQL\Data\BlogDB.mdf'</span> <span style="color: gray;">,</span> <span style="color: teal;">SIZE</span> <span style="color: gray;">=</span> 524288<span style="color: teal;">KB</span> <span style="color: gray;">,</span> <span style="color: teal;">MAXSIZE</span> <span style="color: gray;">=</span> <span style="color: blue;">UNLIMITED</span><span style="color: gray;">,</span> <span style="color: teal;">FILEGROWTH</span> <span style="color: gray;">=</span> 131072<span style="color: teal;">KB</span> <span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;<span style="color: fuchsia;">LOG</span> <span style="color: blue;">ON</span> </span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: gray;">(</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: teal;">NAME</span> <span style="color: gray;">=</span> <span style="color: red;">N'BlogDB_log'</span><span style="color: gray;">,</span> <span style="color: blue;">FILENAME</span> <span style="color: gray;">=</span> <span style="color: red;">N'C:\MSSQL\Logs\BlogDB_log.ldf'</span> <span style="color: gray;">,</span> <span style="color: teal;">SIZE</span> <span style="color: gray;">=</span> 131072<span style="color: teal;">KB</span> <span style="color: gray;">,</span> <span style="color: teal;">MAXSIZE</span> <span style="color: gray;">=</span> 2048<span style="color: teal;">GB</span> <span style="color: gray;">,</span> <span style="color: teal;">FILEGROWTH</span> <span style="color: gray;">=</span> 131072<span style="color: teal;">KB</span> <span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">GO</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">ALTER</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">DATABASE</span> <span style="color: teal;">[BlogDB]</span> <span style="color: blue;">SET</span> <span style="color: blue;">COMPATIBILITY_LEVEL</span> <span style="color: gray;">=</span> 100</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">GO</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">ALTER</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">DATABASE</span> <span style="color: teal;">[BlogDB]</span> <span style="color: blue;">SET</span> <span style="color: blue;">RECOVERY</span> <span style="color: blue;">SIMPLE</span> </span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">GO</span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">This next script will create and populate a table called Tally which has a single column (N type INT) that holds the numbers from 1 to 1 Million.&nbsp; You would not think that having a table with 1 million numbers in it would be that important but once you have read through a few of my blogs you are going to find that you may not be able to live without it.</p>
<div style="border: none; padding: 0in 0in 4.0pt 0in; margin-left: .65in; margin-right: .65in;">
<h3 class="MsoIntenseQuote" style="margin-top: 10.0pt; margin-right: 0in; margin-bottom: 14.0pt; margin-left: 0in;">Table Tally</h3>
</div>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">USE</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: teal;">[BlogDB]</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">go</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: green;">-- A Tally table comes in very handy for lots of different functions (but you should make sure you keep track of how many rows you load</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">CREATE</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">TABLE</span> <span style="color: teal;">Tally</span><span style="color: gray;">(</span><span style="color: teal;">N</span> <span style="color: blue;">INT</span> <span style="color: gray;">NOT</span> <span style="color: gray;">NULL</span> <span style="color: blue;">PRIMARY</span> <span style="color: blue;">KEY</span><span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: green;">-- I am going to keep 1 million rows because that has worked very well for me in the past</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">INSERT</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">INTO</span> <span style="color: teal;">Tally</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: gray;">(</span><span style="font-size: 9.5pt; font-family: Consolas; color: teal;">N</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray;">)</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">SELECT</span><span style="font-size: 9.5pt; font-family: Consolas;"> <span style="color: blue;">TOP</span> 1000000 <span style="color: fuchsia;">ROW_NUMBER</span><span style="color: gray;">()</span> <span style="color: blue;">OVER </span><span style="color: gray;">(</span><span style="color: blue;">ORDER</span> <span style="color: blue;">BY</span> <span style="color: teal;">A</span><span style="color: gray;">.</span><span style="color: fuchsia;">Object_ID</span><span style="color: gray;">)</span> <span style="color: blue;">AS</span> <span style="color: teal;">N</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas; color: blue;">FROM</span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">--Just some random tables so I know my result set will have at least 1 million rows</span></span></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: .0001pt; margin-left: 1.0in; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">all_objects</span> <span style="color: teal;">a</span><span style="color: gray;">,</span> <span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">objects</span> <span style="color: teal;">b</span><span style="color: gray;">,</span> <span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">objects</span> <span style="color: teal;">c</span> </span></p>
<p class="MsoNormal" style="margin-bottom: .0001pt; line-height: normal; text-autospace: none;"><span style="font-size: 9.5pt; font-family: Consolas;">&nbsp;</span></p>
<h1>Comments, Questions and Requests:</h1>
<p class="MsoNormal">I know this is a very simple Blog for the first entry.&nbsp; I understand that there is not much value add, but the main reason for this one is so I can reference it in the future.&nbsp; As new permanent items are added to the BlogDB database I will update this entry and add them to the code for this blog.&nbsp; Please feel free to post comments, leave questions or add requests, and I will do my best to address them as time permits.&nbsp;&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/42/15/99/Initial%20setup.sql" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-42-15-99/Initial-setup.sql">Initial setup.sql</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>