tag:blogger.com,1999:blog-6037519969127043032024-03-13T12:12:13.851-07:00World of MSBIRadhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-603751996912704303.post-54641221785337777322015-08-29T08:26:00.001-07:002016-04-07T05:21:18.252-07:00Role Playing Dimension in Tabular Model(SSAS)<div dir="ltr" style="text-align: left;" trbidi="on">
Role Playing dimension is a single dimension which has multiple references with the fact. Each of these references logically means a different role. Date dimension is the commonly used role playing dimension. The fact dimensions used to have different date columns and the date dimensions used to have reference to these columns.<br />
<div>
<br /></div>
<div>
In Tabular model there is no direct way to define different role to the a dimension. There are some work around to available to get role based dimension feature. </div>
<div>
<br /></div>
<div>
Let's take the AdventureWorks example:<br />
<br />
In this example we will take FactInternetSales dimension and DimDate dimesion. Following are the date keys those are present in the fact:<br />
<br />
<ol style="text-align: left;">
<li>OrderDateKey</li>
<li>DueDateKey</li>
<li>ShipDateKey</li>
</ol>
Create the first relationship between FactInternetSales and DimDate on the basis of Order Date.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjayA58mW7LXSFw0kY6ZB0NyvGSpQbJ62Ad7lsDp174Qc4fIBmdNql9-JfI1tStNiSj4xF8_Zr1Y88CowrlPSejSWJ-OpwMfk1Cdv-1jLQCbrp1lv-V01Qz6gSYtiMdccH3tFuaORaWXw/s1600/AciveDim.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjayA58mW7LXSFw0kY6ZB0NyvGSpQbJ62Ad7lsDp174Qc4fIBmdNql9-JfI1tStNiSj4xF8_Zr1Y88CowrlPSejSWJ-OpwMfk1Cdv-1jLQCbrp1lv-V01Qz6gSYtiMdccH3tFuaORaWXw/s320/AciveDim.PNG" width="320" /></a></div>
<br />
This is the active relation between FactInternetSales and DimDate.<br />
<br />
Now create the relation between FactInternetSales and DimDate on the basis of Ship Date.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrtuUJ-a-vt_zMbTRaid7OtLC3aYLRsRGLHBVyEADShleBPEKIjCL1Wvc9fOBMnUIWvpHd6acnHCxAESmhS_c4fWzmyCrFau7GbtE-R_RkpjaMhLB0xLYPfPkU0DmQouL3ekIPO4AKQXo/s1600/InActiveDim.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrtuUJ-a-vt_zMbTRaid7OtLC3aYLRsRGLHBVyEADShleBPEKIjCL1Wvc9fOBMnUIWvpHd6acnHCxAESmhS_c4fWzmyCrFau7GbtE-R_RkpjaMhLB0xLYPfPkU0DmQouL3ekIPO4AKQXo/s320/InActiveDim.PNG" width="320" /></a></div>
<br />
You can find the active checkbox is unchecked and there a dotted line between FactInternetSales and DimDate which represent the inactive relationship.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIzXMiaTXfrzm8otPFDN1sfU4BCj3UIGP-sw00Gsm3FPpG0Wv0q0yKQyIXcOW7xx3_UgBMQvwYPkveEnMXJf2l_1VtymLScIOrBdeiYg985X7y__19CdHB7A9IH1uLGB6gUi6Uo8xY0Q0/s1600/mapping.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="98" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIzXMiaTXfrzm8otPFDN1sfU4BCj3UIGP-sw00Gsm3FPpG0Wv0q0yKQyIXcOW7xx3_UgBMQvwYPkveEnMXJf2l_1VtymLScIOrBdeiYg985X7y__19CdHB7A9IH1uLGB6gUi6Uo8xY0Q0/s320/mapping.PNG" width="320" /></a></div>
<br />
This is how you can have multiple relationships between a fact and a dimension. Now we will use these relations while calculating measure.<br />
<br />
Create a measure <b>Internet Total Sales:=SUM([SalesAmount])</b>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitoBGbFkQ7p3sclgoA3falvd93sNQY6pfUkHKjZLFiKArsOnFm-AB0V9ay1aXhbhh2WAwlVzKRTIjnt7qzTDVerhLLje7EydLyEwz0hYDzrVJGGARcbrx_531tti3BGkzpyWN6_eFw2jY/s1600/InternetTotalSales.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitoBGbFkQ7p3sclgoA3falvd93sNQY6pfUkHKjZLFiKArsOnFm-AB0V9ay1aXhbhh2WAwlVzKRTIjnt7qzTDVerhLLje7EydLyEwz0hYDzrVJGGARcbrx_531tti3BGkzpyWN6_eFw2jY/s640/InternetTotalSales.PNG" width="640" /></a></div>
<br />
Process the cube and analyse the data in an excel. After analyzing you will found the measure is calculated on the basis of active relationship which is Order Date.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRiEKf3kndQogn2776h_JOKXnj7TVNE3V13JyBFX7qfm5ffuPOg9Dh8xEdLsIMk1mfUyI_l7Ys1nRGAK8dLFwLOToxbSfp65uHp12ZxRW2J7gKTu9xp76c0ab7h-HdyameZe4eW-jqz44/s1600/ActiveDimM.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="259" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRiEKf3kndQogn2776h_JOKXnj7TVNE3V13JyBFX7qfm5ffuPOg9Dh8xEdLsIMk1mfUyI_l7Ys1nRGAK8dLFwLOToxbSfp65uHp12ZxRW2J7gKTu9xp76c0ab7h-HdyameZe4eW-jqz44/s640/ActiveDimM.PNG" width="640" /></a></div>
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigE16w9yiceCK7IiwAPyRQTACdKzVwY2nv0jZzJv2a-0fPwG-xRs0-rSIIprgRPTkJMYxTDko_3Zfn90REuM0Xw9nxQ0Qp4oaPNAFQYZ0lZ1jhnLi4XRb1uCyr0Kg2VqCJnqX8TtE57I0/s1600/ActiveDimMDB.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigE16w9yiceCK7IiwAPyRQTACdKzVwY2nv0jZzJv2a-0fPwG-xRs0-rSIIprgRPTkJMYxTDko_3Zfn90REuM0Xw9nxQ0Qp4oaPNAFQYZ0lZ1jhnLi4XRb1uCyr0Kg2VqCJnqX8TtE57I0/s320/ActiveDimMDB.PNG" width="320" /></a></div>
Now let's create another measure by using the inactive relation Ship Date.<br />
<br />
<b>Internet Total Sales on Ship Date:=CALCULATE(SUM([SalesAmount]),USERELATIONSHIP(FactInternetSales[ShipDateKey],DimDate[DateKey]))</b><br />
<b><br /></b>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoHG8pH1TFuB3ky4n431UCyYhvm3G1muV8IvkiMhGIz1nd5Exk76BI8GC7IXhmIZBkltQncKt0oDsaZ5sL5lZyatg4vzA9OELtbncpsA6FqEQ-g9k_Dn6CPlUgfWWgscODDpodHEGONt0/s1600/InternetTotalSalesShipDate.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoHG8pH1TFuB3ky4n431UCyYhvm3G1muV8IvkiMhGIz1nd5Exk76BI8GC7IXhmIZBkltQncKt0oDsaZ5sL5lZyatg4vzA9OELtbncpsA6FqEQ-g9k_Dn6CPlUgfWWgscODDpodHEGONt0/s640/InternetTotalSalesShipDate.PNG" width="640" /></a></div>
<b><br /></b>
<b><br /></b>
Process the cube and analyse the data in an excel. After analyzing you will found the measure is calculated on the basis of in-active relationship which is Ship Date.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBqOTDmx_Fr8W3HyhFGwp3Q1symCGipn3Oq8ByFGueYiH9pGgP4Pi3J5n741szXhlGHIfxTlRxbH2vTRFzRWgX5wBxeaWC4bx-A5Kc7g5f4osfbe6awAZv4Zd5d55vcAYViol6rXHWCtw/s1600/InActiveDimM.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBqOTDmx_Fr8W3HyhFGwp3Q1symCGipn3Oq8ByFGueYiH9pGgP4Pi3J5n741szXhlGHIfxTlRxbH2vTRFzRWgX5wBxeaWC4bx-A5Kc7g5f4osfbe6awAZv4Zd5d55vcAYViol6rXHWCtw/s640/InActiveDimM.PNG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG8wDnZQ7mDoM09hWfeZcj0LbDafNUtvAMlvj-Jbn0Dm8D0mt3_zFgaZaLWIGWD4Kls2LkkEnqGte4_f1EDP73LLOiuV6kuq6H2UlWjELRSdDPPSVW4958HABef7ta852U4rAjDbIvUPM/s1600/InActiveDimMDB.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG8wDnZQ7mDoM09hWfeZcj0LbDafNUtvAMlvj-Jbn0Dm8D0mt3_zFgaZaLWIGWD4Kls2LkkEnqGte4_f1EDP73LLOiuV6kuq6H2UlWjELRSdDPPSVW4958HABef7ta852U4rAjDbIvUPM/s320/InActiveDimMDB.PNG" width="259" /></a></div>
<br />
<br /></div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-80459411846969250972015-04-05T13:21:00.002-07:002015-04-05T13:21:21.884-07:00Triggering a SSIS package by placing a file in a particular location<div dir="ltr" style="text-align: left;" trbidi="on">
In SQL server 2012 you can trigger a SSIS package by placing a file in a particular location. This can be done by using a File table feature present in SQL Server 2012. This is a new feature introduced in SQL Server 2012.<div>
<br /></div>
<div>
File Table is a special table where you can store a file in SQL Server but the files can be accessed as if it is stored inside file system.</div>
<div>
<br /></div>
<div>
When a file is placed inside the File table location a record get inserted inside the File table. You can have after insert trigger over the File table and the trigger intern execute the package.</div>
<div>
<br /></div>
<div>
<b>Enable File Steam feature inside the Server:</b></div>
<div>
<br /></div>
<div>
<b>Step1: </b>Execute the following query:</div>
<div>
<br /></div>
<div>
<div>
EXEC sp_configure filestream_access_level, 2</div>
<div>
RECONFIGURE</div>
</div>
<div>
<br /></div>
<div>
<b>Step2: </b>Open the Sql Server Configuration Manager and go to the properties of the SQL Server. Open the FileStream tab.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpxQFmGNMNlMf6VDabW17DE7HEwveJL4yV4t3ONzcmYHr9On7EgFM5pxj9PAMCcP3uM2XY8CGCtpS9_hdo5gPKfExUqRqUrE2UHTAXH3TM2L9MXJly3xZrrwO1nhL9RgoYaXxpKD_COfI/s1600/Server.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpxQFmGNMNlMf6VDabW17DE7HEwveJL4yV4t3ONzcmYHr9On7EgFM5pxj9PAMCcP3uM2XY8CGCtpS9_hdo5gPKfExUqRqUrE2UHTAXH3TM2L9MXJly3xZrrwO1nhL9RgoYaXxpKD_COfI/s1600/Server.PNG" height="320" width="275" /></a></div>
<div>
<br /></div>
<div>
<b>Enable File Stream for the database</b></div>
<div>
<b><br /></b></div>
<div>
<b>Step1: </b>Run the following code for your database:</div>
<div>
<br /></div>
<div>
<div>
ALTER DATABASE database_name</div>
<div>
SET FILESTREAM ( NON_TRANSACTED_ACCESS = FULL, DIRECTORY_NAME = N'directory_name' )</div>
</div>
<div>
<br /></div>
<div>
<b>Step2: </b>Open the properties of the database. Go to the Filegroup tab and add FileSTREAM:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiwqW3kZlIlnXbFZofz8duutOIHLNbpE6aAzwVqXK5LioY9FhX46rRDY63cDuMhuLeSKhgkf9cL-C9uICKqn5zXI_tXakEC2Ec_abmSFK1U0UG83U_ZX26dCY41Y3LxiGaRzVaV0Muhrk/s1600/FileStream.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiwqW3kZlIlnXbFZofz8duutOIHLNbpE6aAzwVqXK5LioY9FhX46rRDY63cDuMhuLeSKhgkf9cL-C9uICKqn5zXI_tXakEC2Ec_abmSFK1U0UG83U_ZX26dCY41Y3LxiGaRzVaV0Muhrk/s1600/FileStream.PNG" height="196" width="320" /></a></div>
<div>
<br /></div>
<div>
<b>Step3:</b> Go to the Files tab and add a File in the file category as 'FILESTREAM Data':</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5dbXY1mmnmQcT6Fv04BIS6r-hHn6QpSVYPXvXi_F-Y_Z9D-4RsiaxFIog6ovgy35juJr61yGVqEwG27yax6kiMVcfEvd1CDQ-w2S4la7Wpzx_ndaFet4-nftMsm2I3TyHaYvXHgJjHH4/s1600/FileStreamadded.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5dbXY1mmnmQcT6Fv04BIS6r-hHn6QpSVYPXvXi_F-Y_Z9D-4RsiaxFIog6ovgy35juJr61yGVqEwG27yax6kiMVcfEvd1CDQ-w2S4la7Wpzx_ndaFet4-nftMsm2I3TyHaYvXHgJjHH4/s1600/FileStreamadded.PNG" height="284" width="320" /></a></div>
<div>
<br /></div>
<div>
<b>Creation of the File Group:</b></div>
<div>
<b><br /></b></div>
<div>
Create the File Group by executing the following query:</div>
<div>
<br /></div>
<div>
<div>
CREATE TABLE FileDropLoc AS FileTable</div>
<div>
WITH</div>
<div>
(FileTable_Directory = 'FileDropLoc');</div>
</div>
<div>
<br /></div>
<div>
Then you can access the file location as:</div>
<div>
<br /></div>
<div>
<b><i>\\<ip-address>\mssqlserver\DarkHorse\FileDropLoc</i></b></div>
<div>
<b><i><br /></i></b></div>
<div>
Place a file in the above path and run the following query:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgurvjC3wyxSlylHQT1VGRMvhSxuzu6d017cBs3KNTIE-UZpKjGQvw0b5IUtzRmWbXY8p2Mtkws1BPnTKBoZ5sSe-P_ScWZXja44h_9AmUkdXFL3akIXM5aU9jH3LkQmejQWqRkjkaQWTk/s1600/oneRec.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgurvjC3wyxSlylHQT1VGRMvhSxuzu6d017cBs3KNTIE-UZpKjGQvw0b5IUtzRmWbXY8p2Mtkws1BPnTKBoZ5sSe-P_ScWZXja44h_9AmUkdXFL3akIXM5aU9jH3LkQmejQWqRkjkaQWTk/s1600/oneRec.PNG" height="124" width="320" /></a></div>
<div>
<br /></div>
<div>
You can find one record is present inside the File table. </div>
<div>
<br /></div>
<div>
You can also find the file table created under the File table hierarchy </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpO2P4wunN3r4u5d3fKZ3Jio1G_9QiOGoG9Db-jSfFlSS3cWEbuAx2GPuxHDQ0H0R6LxYMwDitt-AjBfuShrlaoMeAcC2o0MtMyHoToX4UASwGdO9SKoB2i32e1rShgJX0TH_dqeS0KEI/s1600/Filetab'.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpO2P4wunN3r4u5d3fKZ3Jio1G_9QiOGoG9Db-jSfFlSS3cWEbuAx2GPuxHDQ0H0R6LxYMwDitt-AjBfuShrlaoMeAcC2o0MtMyHoToX4UASwGdO9SKoB2i32e1rShgJX0TH_dqeS0KEI/s1600/Filetab'.PNG" /></a></div>
<div>
<br /></div>
<div>
Now you can write a after insert trigger on the File table and can execute the package that you want by using dtexec command line utility or you can run the SQL server job which intern run the package.</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-61469364278127520322015-04-04T13:02:00.001-07:002015-04-04T13:29:31.623-07:00How to use fast load option in OLEDB destination(avoiding bulk data rejection due to violation of constraints)?<div dir="ltr" style="text-align: left;" trbidi="on">
The common issue in OLEDB destination with fast load option is if some error occurs due to constraint violation the whole batch will fail and it will be redirected to the error flow. In this blog i will show you some work around.<br />
<ol style="text-align: left;">
<li>Remove all the constrains from the table.</li>
<li>Have a trigger to validate the constrains like: not null, check constrain where the constraint only applied on the row only.</li>
<li>Have a stored procedure to validate the constraints like: primary key, unique</li>
</ol>
<div>
Let me illustrate this by an example:</div>
<div>
<br /></div>
<div>
There is a table called Emp which is having the following columns and constraints:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJFrA7hExMAIhSFbAfCchVExxsMYzh7U-S6kx3_q6FuF-bGcYv5ZEW73_03MER4aTLUIk66ZG1ZGN7H4tFNWNz1g-Y3CxUt4cT2qmaN8H-dNCL_19asLD3M3S4cqsmweX6nkHFvo2eIjk/s1600/Emp.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJFrA7hExMAIhSFbAfCchVExxsMYzh7U-S6kx3_q6FuF-bGcYv5ZEW73_03MER4aTLUIk66ZG1ZGN7H4tFNWNz1g-Y3CxUt4cT2qmaN8H-dNCL_19asLD3M3S4cqsmweX6nkHFvo2eIjk/s1600/Emp.PNG" height="130" width="320" /></a></div>
<div>
DeptID column is having a reference to the DeptID column of the Dept table. Structure of the Dept table is below:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeHDcKkOheeHO6RmXxyX7abjfLnPg05soynDJR_9UQ-ESdAQTCJqabgUOQfUUStA9sX-B8UYzwnCEgreG8Bw-QlplWGJ2o9y2tbk7Tz91oBO_9HsClbdq7Q4VwLkc_HMyKclMBW50CLH8/s1600/Dept.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeHDcKkOheeHO6RmXxyX7abjfLnPg05soynDJR_9UQ-ESdAQTCJqabgUOQfUUStA9sX-B8UYzwnCEgreG8Bw-QlplWGJ2o9y2tbk7Tz91oBO_9HsClbdq7Q4VwLkc_HMyKclMBW50CLH8/s1600/Dept.PNG" height="98" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The data inside the Dept table is below:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Qyn6emBXmOvFn8rmhIYIcqLMjJeTz6LYJOjVMjboHNJc_w4KK4XK0xl54yhxiA2biOhnrAhesMP84lOrJo7v-uENQFHFbMq0GkaEaTzO4rCoqGPs23zQuiXkLAMvVf_jmWy4DIb9w0U/s1600/Dept_data.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_Qyn6emBXmOvFn8rmhIYIcqLMjJeTz6LYJOjVMjboHNJc_w4KK4XK0xl54yhxiA2biOhnrAhesMP84lOrJo7v-uENQFHFbMq0GkaEaTzO4rCoqGPs23zQuiXkLAMvVf_jmWy4DIb9w0U/s1600/Dept_data.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
For the work around i have created two tables Emp_Temp and Emp_Error.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Emp_Temp: Same structure as EMP without any constraints.</div>
<div class="separator" style="clear: both; text-align: left;">
Emp_Error: Same structure as Emp_Temp with an extra column named ErrorDesc to store the error description.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now we will populate the Emp table by picking data from a flat file source. Following is the data present inside the flat file:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8fM8ReAGPPM3s5ojYc8EWlBQvGtQLgQcVD-sgCrWkO_LjnyRV5GYvGknWcRs-t82jl-cy21hw3MzNQ9U_6NhUZB3B6WnSryXwtsIHt8Z9eqNg_Co0m_uUmGv1M-LJKR347gvldKwb82c/s1600/Emp_txt.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8fM8ReAGPPM3s5ojYc8EWlBQvGtQLgQcVD-sgCrWkO_LjnyRV5GYvGknWcRs-t82jl-cy21hw3MzNQ9U_6NhUZB3B6WnSryXwtsIHt8Z9eqNg_Co0m_uUmGv1M-LJKR347gvldKwb82c/s1600/Emp_txt.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The package should be like this:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGSsZd0vgo75gvUjq0_v6hOLKTgU-mSoChL6iP0eXctX9qfhu-LEmvUNfFuSboI-QfxYrojG9Xb9RZp9glDBlIxna4G_VbokTyKCHWYIY0yeXeUQJTm1U6qhfCZVg9YoLIvTn9_4k-izU/s1600/pkg.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGSsZd0vgo75gvUjq0_v6hOLKTgU-mSoChL6iP0eXctX9qfhu-LEmvUNfFuSboI-QfxYrojG9Xb9RZp9glDBlIxna4G_VbokTyKCHWYIY0yeXeUQJTm1U6qhfCZVg9YoLIvTn9_4k-izU/s1600/pkg.PNG" height="320" width="202" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
There should be a trigger written on the top of EMP_Temp table. The trigger should be as follows:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div>
<div>
CREATE TRIGGER dbo.Tri_EMP</div>
<div>
ON dbo.Emp_Temp</div>
<div>
AFTER INSERT</div>
<div>
AS </div>
<div>
BEGIN</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>-- SET NOCOUNT ON added to prevent extra result sets from</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>-- interfering with SELECT statements.</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>SET NOCOUNT ON;</div>
<div>
<br /></div>
<div>
-- Insert statements for trigger here</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Insert into Emp_Error (</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ErrorDesc</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>SELECT </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>'Not null violation'</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>FROM inserted</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Where Salary is null</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>OR EMPNAME is null</div>
<div>
END</div>
<div>
GO</div>
</div>
<div>
<br /></div>
<div>
Following property need to be set in the OLEDB Destination so that the trigger will be fired:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZg-VmayL5175Bx3AYsRc4ZIcmCaUhX6yvhxwbmbelm_quduzNfaOepqSubnMoKLK-NDnO880imrwcpGKM5AgfuAmM6Jo2g8H65VDmYgOVp60I1gXJWzCFDtfhG554CmM4AJ99WjVZ6bA/s1600/trig_prp.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZg-VmayL5175Bx3AYsRc4ZIcmCaUhX6yvhxwbmbelm_quduzNfaOepqSubnMoKLK-NDnO880imrwcpGKM5AgfuAmM6Jo2g8H65VDmYgOVp60I1gXJWzCFDtfhG554CmM4AJ99WjVZ6bA/s1600/trig_prp.PNG" height="293" width="320" /></a></div>
<div>
<br /></div>
<div>
There should be a procedure as below which will enforce the PK and FK constraints:</div>
<div>
<br /></div>
<div>
<div>
ALTER PROCEDURE EMP_Constraint</div>
<div>
AS</div>
<div>
BEGIN</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>-- SET NOCOUNT ON added to prevent extra result sets from</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>-- interfering with SELECT statements.</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>SET NOCOUNT ON;</div>
<div>
<br /></div>
<div>
Insert into [dbo].[Emp_Error](</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ErrorDesc</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>SELECT </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>'PK Violation.'</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>FROM<span class="Apple-tab-span" style="white-space: pre;"> </span>dbo.Emp_Temp</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>WHERE<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID IN (SELECT EMPID FROM Emp_Temp GROUP BY EMPID HAVING COUNT(1)>1)</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Insert into [dbo].[Emp_Error](</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ErrorDesc</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>SELECT </div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPNAME,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Emp_Temp.DeptID,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Salary,</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>'FK Violation.'</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>FROM<span class="Apple-tab-span" style="white-space: pre;"> </span>dbo.Emp_Temp</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>LEFT</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>JOIN<span class="Apple-tab-span" style="white-space: pre;"> </span>dbo.Dept</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>ON<span class="Apple-tab-span" style="white-space: pre;"> </span>Emp_Temp.deptid=Dept.DeptID</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>WHERE<span class="Apple-tab-span" style="white-space: pre;"> </span>Dept.DeptID IS NULL</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>DELETE<span class="Apple-tab-span" style="white-space: pre;"> </span>dbo.Emp_Temp</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>WHERE<span class="Apple-tab-span" style="white-space: pre;"> </span>EMPID IN (SELECT EMPID FROM Emp_Error)</div>
<div>
END</div>
</div>
<div>
<br /></div>
<div>
Once the data moves into the EMP_Temp table then that need to be transferred to the actual EMP table.</div>
<div>
</div>
<div>
Try it out for your scenario it even works for bulk amount of data. I have used it for data of size 50 million. Good luck.</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-85537284086830488062014-09-12T12:30:00.003-07:002014-09-12T12:30:56.274-07:00Execute SQL Task<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Introduction:</h2>
<div>
<ul style="text-align: left;">
<li>Execute SQL task is a very common task used inside SSIS packages.</li>
<li>As the name says,it can execute a SQL query inside the control flow.</li>
</ul>
<h2 style="text-align: left;">
How to configure:</h2>
</div>
<div>
<ul style="text-align: left;">
<li>Execute SQL task is present inside the toolbox in the control flow tab of a package.</li>
<li>Drag the task and place it inside the control flow</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEQdzN_a9vwqPe50V9EMotmI7SpVMo1-NfV_ZcEX2T7Y9ga04PaMhfKlKF9eIKz5RzBTZ6MpsJjau-5PDT5CeQNzeb3WlsID-6VnSnFW6e0e198exP4-s2jJC-HwBp8wVh_SpZQ5KHDmU/s1600/ES.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEQdzN_a9vwqPe50V9EMotmI7SpVMo1-NfV_ZcEX2T7Y9ga04PaMhfKlKF9eIKz5RzBTZ6MpsJjau-5PDT5CeQNzeb3WlsID-6VnSnFW6e0e198exP4-s2jJC-HwBp8wVh_SpZQ5KHDmU/s1600/ES.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ul style="text-align: left;">
<li>Double click on the task.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidx-HFpy63z9JYTYf6qnYJjiyAQbssadjBijgW-JfaHmcK06gd6h_0WxtIdqmPvNCnLEOZv2BPV5xzK-BGxf27g23xm1ZOdLYba-BxDoQKjTlpTGXeA5y-1_OzfM2mhWHYYW6HA5rO1WI/s1600/ESP1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidx-HFpy63z9JYTYf6qnYJjiyAQbssadjBijgW-JfaHmcK06gd6h_0WxtIdqmPvNCnLEOZv2BPV5xzK-BGxf27g23xm1ZOdLYba-BxDoQKjTlpTGXeA5y-1_OzfM2mhWHYYW6HA5rO1WI/s1600/ESP1.PNG" height="270" width="320" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li>The Execute SQL task editor will appear where you can see all different configurable properties of the task.</li>
<li>Both DML and DDL SQL scripts can be executed by using the Execute SQL task.</li>
<li>In this blog we will see how to execute a SQL script which doesn't return any result set.</li>
</ul>
</div>
</div>
<h2 style="text-align: left;">
Executing a SQL Statement which doesn't return any result set:</h2>
<div>
In this demo a create statement will be executed by Execute SQL task which will not return any result set.</div>
<div>
<ul style="text-align: left;">
<li>Let's say there is a DB named test.</li>
<li>We are going to create a table named EMP with the following attributes.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDkxZs74cX2RemaDsIG0O9HW54VFGg55PegNYgC8NMA4OSfwObK2wABmt9hNrmklLr4ZjaJ9ZynYuOdJ2e4xH9noLZeqgyNgd347WHAjhTlAPjqdWPxeP4euJtS64simAPKrPetlnLk70/s1600/EMP.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDkxZs74cX2RemaDsIG0O9HW54VFGg55PegNYgC8NMA4OSfwObK2wABmt9hNrmklLr4ZjaJ9ZynYuOdJ2e4xH9noLZeqgyNgd347WHAjhTlAPjqdWPxeP4euJtS64simAPKrPetlnLk70/s1600/EMP.PNG" /></a></div>
<div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li>To execute the above statement inside the Execute SQL task we need to create a connection to the TEST Database. Please refer the following post to get the details regarding creating a connection:<a href="http://radhajyotsna0.blogspot.com/2014/09/creating-connection-manager-in-ssis.html" target="_blank">Creating connection manager in ssis</a></li>
<li>Once the connection manager is created for the Database where the table need to be created go the Execute SQL Task editor.</li>
<li>Chose Connection manager name from the Connection drop down</li>
<li>Then place the SQL Statement inside the SQL Statement textbox.</li>
<li>After that click OK and execute the package</li>
<li>Once the package executed successfully you can see a EMP table is created inside the server mentioned in the OLEDB connection manager.</li>
<li>If you try to re-execute the package it will throw error as the table is already created.</li>
</ul>
</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-12393587553052355282014-09-12T12:11:00.002-07:002014-09-12T12:11:13.748-07:00Creating connection manager in SSIS<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: left;">
Introduction:</h2>
<div>
<ul style="text-align: left;">
<li>Creating a connection manager is the first step of creating a Package and is a very important part.</li>
<li>After creating connections only we can do operations inside databases and files.</li>
</ul>
<h2>
</h2>
<h2 style="text-align: left;">
OLEDB Connection:</h2>
</div>
<div>
<ul style="text-align: left;">
<li>OLEDB connection is required to do any operations inside a Database.</li>
<li>Here we will be creating a OLEDB connection to a SQL Server.</li>
<li>To create a connection manager go to the connection manager pan in a package.</li>
<li>Right click on it and choose 'New OLEDB connection' option.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABmor004mI1_VIsG8U31-B1_btMNIhdKZy_qbqi7ULuZ2wE1HBXFqtGzZGRoBbAnYDKhCHd_A4A75x6d5nM4v8qc8k-ErkjzFf2n13AxttB0y6bpaTcuxIlaj3Rm2Wwgajstwhxq9Ees/s1600/Con_WI.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhABmor004mI1_VIsG8U31-B1_btMNIhdKZy_qbqi7ULuZ2wE1HBXFqtGzZGRoBbAnYDKhCHd_A4A75x6d5nM4v8qc8k-ErkjzFf2n13AxttB0y6bpaTcuxIlaj3Rm2Wwgajstwhxq9Ees/s1600/Con_WI.PNG" height="271" width="320" /></a></div>
<div>
<ul style="text-align: left;">
<li>Click on 'New'.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OmA275lWJdXWAEFwvOf0xNhaxNvyQMzJkLqb_mYvk7mYADOwMWPpQWEjdCJv3hPzXsxJeSMOjDwVYoIJGaFg1j052NfD8oylJQsv-9MDYR4rkRO7V0_LUbchHglfOTqyPme-u8TRvqU/s1600/Con_WI1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OmA275lWJdXWAEFwvOf0xNhaxNvyQMzJkLqb_mYvk7mYADOwMWPpQWEjdCJv3hPzXsxJeSMOjDwVYoIJGaFg1j052NfD8oylJQsv-9MDYR4rkRO7V0_LUbchHglfOTqyPme-u8TRvqU/s1600/Con_WI1.PNG" height="320" width="311" /></a></div>
<div>
<ul style="text-align: left;">
<li>Fill the Server information like Server Name, Authentication type, choose the Database and then click test connection.</li>
<li>If all the information is correct you will get the following pup-up.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGGSmrMX2JJ2S2fytCLkDfZfJ-vO14HwsIg5KnMRaKeD8RA2h02WaO-zqohLrGhUOtfWJst2E-o2GvPlmdh0NUyk0XLebOcKYnVHuC0RR5xCnUSlnFpVwEYwHVpbVi4DP0FG2uqZ87sI/s1600/Con_WI_S.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfGGSmrMX2JJ2S2fytCLkDfZfJ-vO14HwsIg5KnMRaKeD8RA2h02WaO-zqohLrGhUOtfWJst2E-o2GvPlmdh0NUyk0XLebOcKYnVHuC0RR5xCnUSlnFpVwEYwHVpbVi4DP0FG2uqZ87sI/s1600/Con_WI_S.PNG" height="61" width="320" /></a></div>
<div style="text-align: left;">
<ul style="text-align: left;">
<li>Click OK and a new connection manager will be created inside the Connection manager Pan.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-57187308216324575692014-09-11T09:58:00.000-07:002014-09-11T09:58:17.319-07:00Getting started with SSIS<div dir="ltr" style="text-align: left;" trbidi="on">
<h1>
What is ‘SSIS’:<o:p></o:p></h1>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<br />
<ul style="text-align: left;">
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">SQL Server integration services (</span><b style="text-indent: -0.25in;">SSIS</b><span style="text-indent: -0.25in;">) is a tool used to Extract,
Transform and Load (</span><b style="text-indent: -0.25in;">ETL</b><span style="text-indent: -0.25in;">) data in
different databases.</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">SSIS is a Microsoft product lunch with SQL
Server 2005. Prior to this it was known as DTS services.</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<o:p></o:p></div>
<h1>
Pre-requisite:<o:p></o:p></h1>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l5 level1 lfo2; text-indent: -.25in;">
<br />
<ul style="text-align: left;">
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">Install SQL Server 2005 or any other version
later to it. This will automatically install SSIS Engine to your system.</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">Open SQL Server Business Intelligence Development
studio (</span><b style="text-indent: -0.25in;">BIDS</b><span style="text-indent: -0.25in;">) to create SSIS
package. </span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l5 level1 lfo2; text-indent: -.25in;">
<o:p></o:p></div>
<h1>
Getting Started:<o:p></o:p></h1>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<br />
<ul style="text-align: left;">
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">To create a SSIS package first a Solution and a
SSIS Project need to be created.</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">A solution is a collection of different types of
project like: SSIS project, SSMS project, SSAS project and different C#
projects.</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">A SSIS Project is a collection of SSIS packages
and other files related to the project.</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">To create a solution go to File->New->Project</span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">Click on Integration Services Project.</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUkR2b94T4mzFmCrawSeNjJ6o-4sXFJEAIjMNuJnTOey16m_CYIW2lmJ7DiXNW7DaJP5A_SQGjOoRAZqpoBwBVuq_V25T_23dL5UBBEN0voow5xlY8i6uTSHhqUJ3z5hh-6y5qNI3tKl8/s1600/SSISProject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUkR2b94T4mzFmCrawSeNjJ6o-4sXFJEAIjMNuJnTOey16m_CYIW2lmJ7DiXNW7DaJP5A_SQGjOoRAZqpoBwBVuq_V25T_23dL5UBBEN0voow5xlY8i6uTSHhqUJ3z5hh-6y5qNI3tKl8/s1600/SSISProject.png" height="218" width="320" /></a></div>
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1027" type="#_x0000_t75"
style='width:468pt;height:319.5pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Shakti\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<br />
<ul style="text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNDZYib8aRl6Z53pXfDQ9uBdHzX-s6mDpwUjqVrVbIwftgb7USRbqnUU8syuO4ua41ASJ6Q_v7o8QdOnr7WUfTyWrkEDEOtgsqWsflryLiwx1106zqAYtaiCj5Z1I-ZMaUvBem-_IO9lo/s1600/SSISProject.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNDZYib8aRl6Z53pXfDQ9uBdHzX-s6mDpwUjqVrVbIwftgb7USRbqnUU8syuO4ua41ASJ6Q_v7o8QdOnr7WUfTyWrkEDEOtgsqWsflryLiwx1106zqAYtaiCj5Z1I-ZMaUvBem-_IO9lo/s1600/SSISProject.png" height="70" width="320" /></a>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><span style="font-family: Symbol; text-indent: -0.25in;"><span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><span style="text-indent: -0.25in;">Fill the Name and location. By default the solution name will be the Name of the project. If you want you can customize the name of the solution. Then press OK. </span></li>
<li><span style="text-indent: -0.25in;"><br /></span></li>
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">Once you click OK a solution and a project will
be created along with a default package.</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<!--[if gte vml 1]><v:shape
id="Picture_x0020_2" o:spid="_x0000_i1026" type="#_x0000_t75" style='width:468pt;
height:104.25pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Shakti\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<h1>
Getting familiar with BIDS:<o:p></o:p></h1>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEWx6t5Wwxg6tV9XhksQt4C_pFoCWdg-js1f68XSg5Cgrbw6w11unuYw3ljI5UKZp5psQb9nxkx5ThCoPGxa0UgMNO3KJY8drOIdN8G9R8yS8-7gG4iAX-X0jXcEL3gfPAy0SXxOrGLSI/s1600/SSISProject.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEWx6t5Wwxg6tV9XhksQt4C_pFoCWdg-js1f68XSg5Cgrbw6w11unuYw3ljI5UKZp5psQb9nxkx5ThCoPGxa0UgMNO3KJY8drOIdN8G9R8yS8-7gG4iAX-X0jXcEL3gfPAy0SXxOrGLSI/s1600/SSISProject.png" height="168" width="320" /></a></div>
<ul style="text-align: left;">
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">The following screen will appear once you click
OK.</span></li>
</ul>
<ul style="text-align: left;">
<li><span style="font-family: Symbol; text-indent: -0.25in;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><span style="text-indent: -0.25in;">The following panes are present inside the BIDS:</span></li>
</ul>
<!--[if !supportLists]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<!--[if gte vml 1]><v:shape
id="Picture_x0020_3" o:spid="_x0000_i1025" type="#_x0000_t75" style='width:468pt;
height:246.75pt;visibility:visible;mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\Shakti\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png"
o:title=""/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Courier New"; mso-fareast-font-family: "Courier New";">o<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Solution Explorer<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Courier New"; mso-fareast-font-family: "Courier New";">o<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Properties<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Courier New"; mso-fareast-font-family: "Courier New";">o<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Toolbox<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Courier New"; mso-fareast-font-family: "Courier New";">o<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Variables<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level2 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "Courier New"; mso-fareast-font-family: "Courier New";">o<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Package<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto; mso-list: l0 level3 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">§<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Control Flow<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto; mso-list: l0 level3 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">§<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Data Flow<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto; mso-list: l0 level3 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">§<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Event Handlers<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto; mso-list: l0 level3 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">§<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Package Explorer<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.5in; mso-add-space: auto; mso-list: l0 level3 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-fareast-font-family: Wingdings;">§<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Connection Manager<o:p></o:p></div>
<h2>
Solution Explorer:<o:p></o:p></h2>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Shows all the Data Sources, Data views, Packages
and files preset inside the solution.<o:p></o:p></div>
<h2>
Properties:<o:p></o:p></h2>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Shows the property of the selected component.<o:p></o:p></div>
<h2>
Toolbox:<o:p></o:p></h2>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Contains different tasks when the Control flow
tab is open.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Contains different transformations when the Data
flow tab is open.<o:p></o:p></div>
<h2>
Variables:<o:p></o:p></h2>
<div class="MsoListParagraph" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Contains all the user defied and system defined
variables present inside the package.<o:p></o:p></div>
<h2>
Package:<o:p></o:p></h2>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Package is a collection of task that is to be
performed to do the ETL.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l3 level1 lfo4; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->It’s a XML file containing all the ETL
instructions inside the XML tags and saved with .dtsx extension.<o:p></o:p></div>
<div class="MsoNormal">
There are four tabs present inside the package area:<o:p></o:p></div>
<h3>
Control Flow:<o:p></o:p></h3>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l6 level1 lfo5; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Contains all tasks present inside a package.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l6 level1 lfo5; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Task is the granular level of work that a
package performs. For example: Execute SQL Task, Data Flow task, Send mail task<o:p></o:p></div>
<h3>
Data Flow:<o:p></o:p></h3>
<div class="MsoListParagraph" style="mso-list: l4 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Data flow contains source where the data need to
be extracted, transformations which modifies data according to the business
requirement and target where the transformed data going to reside.<o:p></o:p></div>
<h3>
Event Handler:<o:p></o:p></h3>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l4 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Event handler also contains task like the
control flow. The only difference is the tasks will trigger only when the
associated event happens.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l4 level1 lfo6; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->The events can be associated on the package
level, container level or on the task level.<o:p></o:p></div>
<h3>
Package Explorer<o:p></o:p></h3>
<br />
<div class="MsoListParagraph" style="mso-list: l2 level1 lfo7; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;">·<span style="font-family: 'Times New Roman'; font-size: 7pt;">
</span></span><!--[endif]-->Contains the hierarchical structure of all the
components present inside a package.<o:p></o:p></div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-74638861799043896112013-10-01T12:00:00.002-07:002013-10-01T12:00:25.596-07:00How to handle source records containing delimiters in delimted Flat file connection manager<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="text-align: left;">
Introduction</h4>
<div style="text-align: left;">
It's common scenario in ETL while you find presence of delimiter character inside the source records while importing data into flat file. Though the flat file will be exported without any error while reading it back it will create problem as the number of columns will increase for that row. </div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
Without wasting more words I will now show to avoid such situations.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Solution</h4>
<div style="text-align: left;">
To avoid such problems you need to add a text qualifier in the Flat file connection manager.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
In the following example the source data is present inside SQL Server. Following is the data.</div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDwOAw3WOyv_LIQvrPOt63QE_4B_yRgb3xnY0_MJqDV9pHfmJDFi3tczrGvnjbeR22MCZ_qtfDQxNyD1E6ETFEvNg5rCX65EbbT7zOMPbWXXP2S81aIc5HSvZU8-mFbWCEBoLgubLq04k/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a> </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXnjI6NDgTowYkpInyZrQVtHm293gAkXG4jG_zDqvfRcCXSMSw7-pN_So7qmtYAmeiy6BHWyxT2BepKFut96c1yjAyFtcOXihT4cWk4ps2WH2KnMuE-eP9_Qrqs-VDUmWxVyHoDMQr4Co/s1600/SrcRecords.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXnjI6NDgTowYkpInyZrQVtHm293gAkXG4jG_zDqvfRcCXSMSw7-pN_So7qmtYAmeiy6BHWyxT2BepKFut96c1yjAyFtcOXihT4cWk4ps2WH2KnMuE-eP9_Qrqs-VDUmWxVyHoDMQr4Co/s1600/SrcRecords.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
We will use double quotes(") as the text qualifier. So while importing the data we will replace the double quotes with two double quotes. Means</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbIWKxhiZGmGgO-039TEfCUsT9W6sMiDXsPEGZ6su6hG6fx-soQLb21cUj1QD73bnuV3Hh8szG_ju-d9OYfEBMcPwAcYu7_hWBRTyJsih1hwelQE29cUsY59Lq4Qs6EljA5t8qC2oVIvY/s1600/SrcQuery.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbIWKxhiZGmGgO-039TEfCUsT9W6sMiDXsPEGZ6su6hG6fx-soQLb21cUj1QD73bnuV3Hh8szG_ju-d9OYfEBMcPwAcYu7_hWBRTyJsih1hwelQE29cUsY59Lq4Qs6EljA5t8qC2oVIvY/s1600/SrcQuery.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div style="text-align: left;">
This query is placed in the OLEDB source. Then the records pulled will be exported to a comma delimited Flat file. The text qualifier should be set as double quotes(").</div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyH4jF-cogeFsXLoR8wcQXXvJhlNUxvERKzrJ3lJy63Igyfe9w7CU5B1MtdgzzF0_gE9W0YuHyPsZq3rHtglSP2_a1CvZpo6EDn4K_E1LIah-yVD3YAzqAjFXoWGYq0D3uCf9m_1SW7Eg/s1600/Flat+File+Connection+Manager.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyH4jF-cogeFsXLoR8wcQXXvJhlNUxvERKzrJ3lJy63Igyfe9w7CU5B1MtdgzzF0_gE9W0YuHyPsZq3rHtglSP2_a1CvZpo6EDn4K_E1LIah-yVD3YAzqAjFXoWGYq0D3uCf9m_1SW7Eg/s1600/Flat+File+Connection+Manager.png" height="288" width="320" /></a></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
While reading the file also the same connection manager should be used. And following is the data viewer screen shot while reading the data back from the Flat file:</div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqy68YdokCG2RJceWik1L2jf6YvI_swsmVOP-2VaFvYLpEyEba6I3Rm14iE4GFVZSUux5zQW5ahr1nVGhoJ479YRUaH9oAXVl9SAWBldF1RxHSFpgbi8Cm7dlgsJVVvSwVAvGESxHPsYk/s1600/output.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqy68YdokCG2RJceWik1L2jf6YvI_swsmVOP-2VaFvYLpEyEba6I3Rm14iE4GFVZSUux5zQW5ahr1nVGhoJ479YRUaH9oAXVl9SAWBldF1RxHSFpgbi8Cm7dlgsJVVvSwVAvGESxHPsYk/s1600/output.png" height="320" width="320" /></a></div>
<div style="text-align: left;">
</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-43269628396974772792013-09-28T23:39:00.001-07:002013-09-28T23:39:45.449-07:00SQL Server, SSIS, SSRS, SSAS and DW interview questions...<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">61. How to remove Sort transformation?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. You can avoid the Sort transformation while using OLEDB
sources. You can use order by clause to sort the input records. Then set the
Issorted property as true and set the sort key positions of the order by
columns. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">62. How to put if else in Data Flow and Control Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Control flow- Precedence constraints</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Data flow-Conditional Split transformation </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">63. How to set the Buffer in Data Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Each DFT has 2 properties-DefaultMaxBufferRows and
DefaultMaxBufferSize which control respectively the number of rows which can be
stored in a single buffer and how many buffers can be
created.DefaultMaxBufferRows has default value 10000 rows and
DefaultMaxBufferSize has default value 10 MB.Any data eg BLOB data if cant be
put in the buffer is spooled to the File System.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">64. How to ignore the failure in Control Flow and Data
Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. <span style="mso-spacerun: yes;"> </span>Control Flow-
Use precedence constraints as on completion</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Data Flow- Redirect row on failure</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">65. How to migrate DTS packages to SSIS packages?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Open<span style="mso-spacerun: yes;"> </span>BIDS.In
BIDS go to the Project tab and click on Migrate DTS 2000 Package.Give the
Source location and destination location and complete the wizard steps.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">66. How you upgrade a package from SSIS 2005 to SSIS
2008r2?<span style="mso-spacerun: yes;"> </span>Ans. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">67. How to create a SSAS Cube and deploy it?(Building a cube
with data source)<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.First create an analysis services project.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.Create a Data Source (Connection made to the server and database
and authentication provided.) by right clicking on the data source of the
project which will start a wizard.(Extension will be .ds)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Create a Data Source View(Add tables from one or more
database and add related tables for the added tables.Can also add filters) by
right clicking on the data source view of the project which will start a
wizard.(Extension will be .dsv)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.Right Click on the Cube and Click on a new cube which will
start a Cube wizardThe Cube Wizard will ask for Select bui.Here we have to
check the measure group tables and check the relevant measures for the measures
group tables and dimension tables.(Extension will be .cube)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.To hide particular measure groups and dimensions to
particular users,create perspectives.We can rename the already created
perspective and for the new perspective we can check and uncheck based on the
requirement.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.In BIDS,we can build and then deploy the cube.After that
we can right click on the particular cube and then browse.In browse window,we
will have drag nad drop row fields and column fields.In Row fields basicallly
we will drag dimension rows and in column fields we will drag fact measures.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">68. How to create a SSAS Cube and deploy it?(Building a cube
without data source)<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.Right Click on Cube.Cube wizard will ask for 'Select
build method-with or without using data source'.Click on ""Build the
cube without using data source"".</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.Then define measures.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Define Dimensions and Dimension Usage and complete the
wizard. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.Now create the datasourceview and create data source in
that.The wizard that pops up this time is called Schema Generation wizard.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.Populate the data source with data so that cube can be
populated.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.Process the Cube and View the Cube."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">69. How to create an SSRS report using SSAS?<span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.In the Data Source,put the Source type as Analysis
Services and put the analysis Server name.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.In the Dataset,click on Query builder.The Query builder
will open the SSAS Query Designer Window.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Then we can drag and drop fields on the results pane of
the Query designer as per our requirement.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.There are several buttons in the tool bar of the Query
builder that can be used in MDX like Add Calculated Members,Show Empty
Cells,Auto Exec,Show Aggregates.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.The Auto Exec button turns on and off the execution of
queries.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.The Show Empty Cells works this same as the MDX Non Empty
clause; basically it shows / hides non empty cell values. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">7.In the upper half of the design area,the query designer
contains a filter grid which is useful for filtering the results and serves as
an easy way of creation of parameters.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">8.Clicking OK on the SSAS query builder gives rise to MDX
query in the query string of Dataset.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">9.Now we can make any type of reports using the fields
provided by the dataset."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">70. How to create parameters/Multivalued parameters in SSRS
report using SSAS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.We can put<span style="mso-spacerun: yes;"> </span>all
values in the filter expression and can check the parameter.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.By default,in report parameters a report parameter will be
created and a hidden dataset for the parameter will be created.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.If we right click on the dataset and click on
""Show Hidden Datasets"",then we will get the dataset.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.But in previewing the report,we will get two All
values-one Select All and another All.One Select All is the property of the
SSRS multivalued Property of the parameter and the second parameter is driven
from the MDX query that SSRS runs to populate the parameter list. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.We can remove the second one by :-</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>making a change in
the MDX query i.e. making Parameters.AllMembers as parameters.Children or
filtering out the condition that Parameterlevel > 0 .(Because All of MDX
query will have Parameter level 0)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">71. What is Cube Scheduling?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When we deploy a SSAS Project,the Data Sources,Data
Source Views<span style="mso-spacerun: yes;"> </span>are put in the local
instance of the SQL Server Analysis Server.Whatever changes are made to the
production database or Analysis service will not be reflected in the local
instance of analysis service until we deploy the project again.We have to
process the cube each and everytime.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">We can process the cube manually (using Management Studio).</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)In order to schedule the processing of the cubes at a
particular time,we can make use of Analysis Services Process Task in SSIS and
give the Cube name.Then we can make a job scheduling this Package.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Right click on the cube and click on process.Click on
Script and click on Copy to clipboard and cancel.Then make a new job and in
command,paste the same and schedule the job."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">72. What is Dimensions?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Dimension is a context by which we slice and dice data
in a DW.Types :1)Conformed 2)Junk 3) Role playing</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">73. What is Conformed Dimensions?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Two dimensions are said to be conformed if they are
completely identical or strict mathematical subsets of each other.Conformed
dimensions have same row headers and labels also.Eg:-Time dimension used for
Fact1 and Time dimension used for Fact2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">74. What is Junk Dimensions?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. After database modelling,if there are some attributes
which are not linked to any of the dimensions or fact and they are of less
importance and they carry some distinct values(mostly flag values or
indicators),then in that case we can go for a dimension which carries all these
attibutes.These dimensions are known as junk dimensions.Benefits :-One
dimension having all the attributes will perform better compared to individual
dimension for each attribute.Disadvantage:-If in future we will think of making
an attribute as a fully fledged dimension,then in that case we have to
restructure the cube.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">75. What is Degenerate Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When we have columns on the fact table that do not
relate to any of the dimensions but are most required for analysis,then we can
make<span style="mso-spacerun: yes;"> </span>a separate dimension for the
attribute.This dimension is called Degenerate Dimension.For Eg: A transaction
number or a ticket number which is a most requested feature can be stored
separately as distinct values in a degenerate dimension because the fact will
have multiple records for 1 transaction id.So while quering or analysing
Transaction no or Ticket no,we can go by degenerate dimension table.In some of
the degenerate dimensions,we can put another column which is not degenerate and
a running id for the degenerate transaction id.The difference between normal
dimension and a degenerate dimension is that degenerate attribute should not be
available to the end user for analysis in analysis services.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">76. What is Role Playing Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Dimensions are often recycled for multiple applications
within the same database.A Date dimension can be used for
Date_of_Hire,Date_of_Joining etc.So it’s a role playing dimension. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">77. Explain Slowly Changing Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Slowly Changing Dimensions are dimensions that have
data that changes slowly rather than changing on<span style="mso-spacerun: yes;"> </span>a time based regular schedule.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Type 0-No action is taken</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Type 1-overwrites old data with new data and therefore
does not maintain history</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Type 2-Maintains history by inserting multiple records for
a natural key with different surrogate keys(a running number against a natural
key of the table) and having version numbers or Start Date-End Date.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)Type 3-Contains a column in the table which represents
Original_state.This column contains the first value of the attribute where as
Current_state contains the present value.This doesnt maintain histories of
values in between the original and current state.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)Type 4-Contains a table which will have the current record
and another history table with a create date column.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6)Type 6-Combines approaches of types 1,2 and3.It maintains
individual records having start date,end date and Flag.The Current record's
Flag is set to Y rest all are set to N's."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">78. What is Factless tables or Bridge Tables?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. If in a fact table there exists many to many
relationships with dimensions with no figures or measures or values then it is
known as Factless fact or bridge tables.This table is needed to bridge the
relationships between dimensions.For Eg suppose we have a product dimensions
which contain product key and product related information and we have an offer
dimension which contain offer key and discount related information,its timing
and pricing.We can make a bridge table of Productoffer which stores the product
which has special offers.If the Fact stores Product,Offer and Sale as
Columns,then we will surely miss the information about products which were
having special offers but not having a sale.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">79. What is Snapshot and transaction fact tables?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A Transaction fact table records events and for each
event certain measurements are recorded or values recorded.So when we record a
sale we create a new row altogether for the information relating to sale.A
snapshot fact table records the state of something at different points of
time.For Example the sales of each product every month.Snapshot Fact table
therefore keeps aggregated information which results in lesser data rows,lesser
cubes,faster cube processing and faster querying.But it has no information on
individual transaction levels.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">80. What is UDM(Unified Dimensional Modelling)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It provides a bridge between the user and the data
sources.A UDM is constructed over one or more physical data sources and then
the user issues queries against the UDM.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">81. What is Two tier architecture of SSAS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. SSAS uses both server and client components to supply
OLAP and data mining functionality.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Server component is implemented as a Microsoft windows
service.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2) Clients interact using Standard XML."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">82. Difference between Derived measure and Calculated
measure?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1) A derived measure calculates before agggregations
are created and the value is stored in the Cube.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)A calculated measure calculates after aggregations are
created and the value is not stored inside the Cube."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">83. What is Cube?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Cubes are a logical representation of multidimensional
data.It stores large amounts of historical data.It alos shows the point in time
data and it shows the member level data and security is very detailed.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">84. Differences between OLTP and OLAP<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)OLTP contains the source information of any
system.OLAP contains the data from OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)OLTP controls and runs the fundamental business tasks like
insertion,updation etc but OLAP is meant for planning,analysing and decision
support.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)OLTP performs transactions like insert,update,delete
etc.OLAP performs querying and analysis of the aggregated data of OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)OLTP basically uses smaller and less complex queries but
OLAP uses complex queries.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)OLTP is normalized with 3N but OLAP is denormalized with
Star Schema or snowflake schema.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6)OLTP uses relational schema but OLAP uses multidimensional
schema.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">7)Backup of OLTP is very important but in case of OLAP we
can always bring it from OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">8)Data in OLTP can be seen instantly but in OLAP a batch or
scheduler wil refresh the data."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">85. Star Schema vs Snowflake Schema<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Snowflake Schema:No redundancy,normalized,more complex
queries,more joins,more FK's,good to use for small dw,To be used when dimension
table is small in size</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Star Schema:Redundant data,de normalized,less complex,good
to use for large dw's,To be used when dimension table is very big in size"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">86. What is Normalization?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Normalization is the mathematical model of evaluating
the relational quality of the data model.The purpose is to reduce update
anomalies.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">87. What is First Normal Form(1 NF)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 1st Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Every unit of data should be represented by a scalar
value.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Each and every attribute i.e column should be unique in an
entity.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Each and every tuple should be unique in an entity.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Consider a case where a table has columns
basecamp,tour1,tour2,tour3.This table violates 1NF because there are so many
attributes holding the same meaning.We can make two tables one having basecamp
id and basecamp and the other table having basecampid and tour to bring it to
1NF."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">88. What is Second Normal Form(2 NF)?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 2nd Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)The entity should be in 1 NF and</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)There should be no partial dependency on the Primary
Key.Suppose in the basecamp-tour table,we have columns basecampid,tour and
phonenumberofthebasecamp.The PK of the table is a composite primary key having
basecampid and tour columns.But in this case phonenumber is dependent on
basecamp not on tour.So this violates 2NF.We can make two tables basecamp-tour
having basecampid and tour and second table having basecampid and phonenumber.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">89. What is Third Normal Form(3NF)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 3rd Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)the entity should be in 2nF and</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)There should be no transitive dependency on the primary
Key.Suppose there ia atable basecamp-tour in which we have columns like
Basecamp_id,Tour,Guide and GuideDateofHire.In this case GuideDateofHire is
dependent on Guide which again is dependent on Basecamp_id.Thats why this
violates the 3 NF.To resolve this,we can make another table Guide having Guide
and GuideDateofHire."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">90. What is Boyce Codd Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It occurs between the third and fourth normal forms.It
handles those kind of entities which have two sets of primary keys.In such case
BCNF states that the entity should be split into two entities one for each
primary key.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"></span><br /></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">91. What is Fourth Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It reduces problems created by complex composite
primary keys.If there are three attributes in an entity in which two of the
attributes combine to form a composite primary key but without the third attribute
the row is not unique,then in that case the entity violates 3NF.In such case we
should split the table into two separate tables.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">92. What is Fifth Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 5NF provides the method for designing relationships
that involve 3 or more entities.A three-way or ternary relationship, if
properly designed, is in the fifth normal form.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">93. What is Recovery Models in SQL Server 2008?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Simple,Full,Bulk Logged</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Alter database databasename set recovery simple</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">94. What is Simple Recovery Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)SQL Server stores only minimal information in the
transaction log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)The Changes made to the database are written to the data
and to the log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)But the log files are not kept permanently.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)It should be used on a db which is meant for development
or test where there is a reduced need of frequent database backups.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Backup options for this model are Full .</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">95. What is Full Recovery Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. This allows us to recover everything.It can use fullest
set of backup options.So it can be used to recover the fullest set.Every
insert,update,delete is logged into the transaction log.The committed changes
are deleted from the log once the back up of the log is taken.It allows
point-in-time recovery means it allows us to recover the database to a
particular point in time.Backup options for this model are Full,Differential
and Transaction Log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">96. What is Bulk Logged Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. This is same as Full Recovery model but this is used in
cases of bulk operations like create index,select into and bulk insert.All the
bulk operations are written minimally to the transaction log there by improving
performance.Backup options for this model are Full,Differential and Transaction
Log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">97. What is Backups?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Full,Differential and Transaction</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">98. What is Full Backups?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A full backup retsores all our data but it will not
restore all the data at a specific point of time.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">99. What is Differential Backup?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A differential back up copies all the data changes
since the last full back up.So these back ups are usually faster and smaller
than Full back ups.A Full backup creates a checkpoint meaning that the
differential back up has to start from that point.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">100. What is Transaction Log Back up?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A transaction log backup will copy all the data changes
since the last Full transaction or previous transaction log back up.they are
fast and small but the demerit is recovery where we will get a transaction log
for each day.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">101. What is MSDTC?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. MSDTC is a Transaction Manager which allows the client
application to include different sources of data within one transaction.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">For example: SSIS includes different data sources data into
one transaction to main the acid property.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">102. What is ACID?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Atomic, Consistent, Isolated and Durable.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">103. What is Report Subscription?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A Subscription is a standing request to deliver a
report at a specific time or to respond to a specific event, and in an
application file format that you specify in the subscription.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Two types- Standard Subscription, Data driven Subscription</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Stanard Subscription- Consists if static values and cann't
be modified during subscription processing.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Datadriven Subscription- get subscription information at
runtime by quering an external data source that provides values used to specify
reciptant, parameter or application format.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">104. What is XML from a select query?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. <Select query> For XML RAW/AUTO/PATH/EXPLICIT;</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml raw</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><row EmpName=""Shakti""
DeptID=""2"" Sal=""3000""/><row
EmpName=""Praveen"" DeptID=""2""
Sal=""4000""/><row EmpName=""Rohit""
DeptID=""1"" Sal=""2000""/><row
EmpName=""Wamsi"" DeptID=""1""
Sal=""1500""/><row EmpName=""Kapil""
DeptID=""2"" Sal=""1300""/><row
EmpName=""XXX"" DeptID=""10""
Sal=""1000""/><row EmpName=""Rahul""
DeptID=""1"" Sal=""1000""/></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml auto</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><emp EmpName=""Shakti""
DeptID=""2"" Sal=""3000""/><emp
EmpName=""Praveen"" DeptID=""2""
Sal=""4000""/><emp
EmpName=""Rohit"" DeptID=""1""
Sal=""2000""/><emp
EmpName=""Wamsi"" DeptID=""1""
Sal=""1500""/><emp
EmpName=""Kapil"" DeptID=""2""
Sal=""1300""/><emp
EmpName=""XXX"" DeptID=""10""
Sal=""1000""/><emp
EmpName=""Rahul"" DeptID=""1""
Sal=""1000""/></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml path</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><row><EmpName>Shakti</EmpName><DeptID>2</DeptID><Sal>3000</Sal></row><row><EmpName>Praveen</EmpName><DeptID>2</DeptID><Sal>4000</Sal></row><row><EmpName>Rohit</EmpName><DeptID>1</DeptID><Sal>2000</Sal></row><row><EmpName>Wamsi</EmpName><DeptID>1</DeptID><Sal>1500</Sal></row><row><EmpName>Kapil</EmpName><DeptID>2</DeptID><Sal>1300</Sal></row><row><EmpName>XXX</EmpName><DeptID>10</DeptID><Sal>1000</Sal></row><row><EmpName>Rahul</EmpName><DeptID>1</DeptID><Sal>1000</Sal></row></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="mso-spacerun: yes;"><span style="font-family: inherit;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 1 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">union</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 2 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>1 as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>DeptID as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>null as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">union</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 3 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>2 as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>DeptID as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Sal as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">order by EmpName</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">for xml explicit</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><Employee
EmpName=""Kapil""><DeptID
DeptID=""2""><Sal
SAL=""1300""/></DeptID></Employee><Employee
EmpName=""Praveen""><DeptID
DeptID=""2""><Sal
SAL=""4000""/></DeptID></Employee><Employee
EmpName=""Rahul""><DeptID
DeptID=""1""><Sal
SAL=""1000""/></DeptID></Employee><Employee
EmpName=""Rohit""><DeptID DeptID=""1""><Sal
SAL=""2000""/></DeptID></Employee><Employee
EmpName=""Shakti""><DeptID
DeptID=""2""><Sal SAL=""3000""/></DeptID></Employee><Employee
EmpName=""Wamsi""><DeptID
DeptID=""1""><Sal
SAL=""1500""/></DeptID></Employee><Employee
EmpName=""XXX""><DeptID
DeptID=""10""><Sal
SAL=""1000""/></DeptID></Employee></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">the values in the Tag and Parent meta columns, the
information provided in the column names, and the correct ordering of the rows
produce the XML you want when you use EXPLICIT mode.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">105. What is SET XACT_ABORT { ON | OFF }?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Specifies whether SQL Server automatically rolls back
the current transaction when a Transact-SQL statement raises a run-time error.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">106. What is Computed Column?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A computed column is computed from an expression that
can use other columns in the same table. The expression can be a noncomputed
column name, constant, function, and any combination of these connected by one
or more operators. The expression cannot be a subquery. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">For example, in the AdventureWorks2008R2 sample database, the
TotalDue column of the Sales.SalesOrderHeader table has the definition:
TotalDue AS Subtotal + TaxAmt + Freight. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Unless otherwise specified, computed columns are virtual
columns that are not physically stored in the table. Their values are
recalculated every time they are referenced in a query. The Database Engine
uses the PERSISTED keyword in the CREATE TABLE and ALTER TABLE statements to
physically store computed columns in the table. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Computed columns can be used in select lists, WHERE clauses,
ORDER BY clauses, or any other locations in which regular expressions can be
used, with the following exceptions:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Computed columns
used as CHECK, FOREIGN KEY, or NOT NULL constraints must be marked PERSISTED. A
computed column can be used as a key column in an index or as part of any
PRIMARY KEY or UNIQUE constraint if the computed column value is defined by a
deterministic expression and the data type of the result is allowed in index
columns.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>For example, if
the table has integer columns a and b, the computed column a + b can be
indexed, but computed column a + DATEPART(dd, GETDATE()) cannot be indexed
because the value may change in subsequent invocations.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>A computed column
cannot be the target of an INSERT or UPDATE statement.</span></div>
<span style="font-family: inherit;">
</span></div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com3tag:blogger.com,1999:blog-603751996912704303.post-25994583280181471702013-09-28T03:23:00.000-07:002013-09-29T05:11:52.015-07:00Bulk Upsert operation of SalesForce from SSIS package using Data Loader<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
Introduction:</h3>
<div style="text-align: left;">
In this post I will explain how to push data inside Salesforce through SSIS package using Bulk Load API. I will demonstrate it by using two example how to pull the data from Sql Server or any other database and how to pull data from CSV file.</div>
<div style="text-align: left;">
</div>
<h3 style="text-align: left;">
Technology used:</h3>
<div style="text-align: left;">
SSIS, SaleForce Data Loader Tool.</div>
<div style="text-align: left;">
</div>
<h3 style="text-align: left;">
Pre-requisites:</h3>
<div style="text-align: left;">
Sales Force Data Loader tool and the SSIS must be installed in your system.</div>
<div style="text-align: left;">
</div>
<h3 style="text-align: left;">
Over View:</h3>
<div style="text-align: left;">
Data Loader has a command line utility called process.bat. This utility can load data inside SalesForce from different source systems like CSV file,Oracle, SQL Server etc.. </div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
To import data from different source system the JDBC driver is required for that to establish the connection.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
Two xml files are required named: </div>
<ol>
<li><div style="text-align: left;">
process-cnf.xml</div>
</li>
<li><div style="text-align: left;">
database-cnf.xml</div>
</li>
</ol>
<div style="text-align: left;">
The database-cnf file will have the source related information and the process-cnf will contain the salesforce related information.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
The SSIS package will call the process.bat file which in turn use process-cnf and database-cnf and load data inside SalesForce.</div>
<div style="text-align: left;">
</div>
<h3 style="text-align: left;">
Process</h3>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step 1<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Install Apex Loader. Go to the following path:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">C:\Program Files (x86)\salesforce.com\Data Loader\bin<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">You will find the following bat files:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo1; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">1.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">encrypt.bat<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in; mso-list: l1 level1 lfo1; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">2.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">process.bat<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">According to your source system get the JDBC drive. For
example for SQL Server have the following driver:com.microsoft.sqlserver.jdbc.SQLServerDriver<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">And modify the process.bat in the following way:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">@echo off<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">if not [%1]==[] goto run<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo Usage: process ^<configuration directory^> ^[process
name^]<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>configuration
directory -- directory that contains configuration files,<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>i.e.
config.properties, process-conf.xml, database-conf.xml<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>process name
-- optional name of a batch process bean in process-conf.xml,<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>for
example:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;">
</span>process ../myconfigdirAccountInsert<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>If
process name is not specified, the parameter values from config.properties<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>will be
used to run the process instead of process-conf.xml,<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;"> </span>for
example:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo<span style="mso-spacerun: yes;">
</span>process ../myconfigdir<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">echo.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><o:p><span style="font-family: Calibri;"> </span></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">goto end<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><o:p><span style="font-family: Calibri;"> </span></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">:run<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">set PROCESS_OPTION=<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">if not [%2]==[] set PROCESS_OPTION=process.name=%2<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><o:p><span style="font-family: Calibri;"> </span></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">..\Java\bin\java.exe -cp ..\dataloader-27.0.1-uber.jar<span style="background: yellow; mso-highlight: yellow;">;"C:\Work Area\JDBC Driver\Microsoft
JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc4.jar"</span>
-Dsalesforce.config.dir=%1 com.salesforce.dataloader.process.ProcessRunner
%PROCESS_OPTION%<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><o:p><span style="font-family: Calibri;"> </span></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">:end<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><o:p><span style="font-family: Calibri;"> </span></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Add the highlighted portion which is the driver path.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step 2<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Create a xml file named database-conf.xml. Please put the
following XML code inside and provide the following information regarding your
source:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">1.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Connection
URI<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">2.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">User ID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">3.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Password<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">4.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Source
Query<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo2; text-indent: -0.25in;">
<!--[if !supportLists]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: Calibri;">5.</span><span style="font-size-adjust: none; font-stretch: normal; font: 7pt/normal "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Source
columns<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><beans><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><bean id="dbDataSource"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">class="org.apache.commons.dbcp.BasicDataSource"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">destroy-method="close"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="url" value=<Connection
URI>/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="username"
value="UID"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="password"
value="PASSWORD"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></bean><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><bean id="queryAccount"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">class="com.salesforce.dataloader.dao.database.DatabaseConfig"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">singleton="true"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="sqlConfig" ref="queryAccountSql"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="dataSource"
ref="dbDataSource"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></bean><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><bean id="queryAccountSql"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">class="com.salesforce.dataloader.dao.database.SqlConfig"
singleton="true"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="sqlString"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><value><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-spacerun: yes;"> </span>YOUR Query<span style="mso-spacerun: yes;"> </span></value><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></property><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="columnNames"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><list><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><value>Column0</value><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span><value>column1</value><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></list><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></property><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></bean><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></beans><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step3:<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Create an encrypted SalesForce password file by using the
following command:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">encrypt.bat –e <password>
"<filepath>\key.txt"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step4:<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Create a mapping file between source and target columns. The
file should of SDL extension.<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Please find the sample mapping file<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">#Mapping values<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">#Mon Jan 23 17:07:24 PST 2006<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">SLA__c=SLA__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">BillingCity=BILLINGCITY<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">=SYSTEMMODSTAMP<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">OwnerId=OWNERID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">CustomerPriority__c=CUSTOMERPRIORITY__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">AnnualRevenue=ANNUALREVENUE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Description=DESCRIPTION<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">BillingStreet=BILLINGSTREET<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ShippingState=SHIPPINGSTATE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">=CREATEDBYID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">=CREATEDDATE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Website=WEBSITE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">BillingState=BILLINGSTATE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">=LASTMODIFIEDBYID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">=LASTMODIFIEDDATE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Phone=PHONE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">NumberOfEmployees=NUMBEROFEMPLOYEES<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Type=TYPE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ShippingCity=SHIPPINGCITY<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Rating=RATING<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Industry=INDUSTRY<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ShippingStreet=SHIPPINGSTREET<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">UpsellOpportunity__c=UPSELLOPPORTUNITY__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">AccountNumber=ACCOUNTNUMBER<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">TickerSymbol=TICKERSYMBOL<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Id=ID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">BillingPostalCode=BILLINGPOSTALCODE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Site=SITE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ParentId=PARENTID<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Name=NAME<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">BillingCountry=BILLINGCOUNTRY<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">SLAExpirationDate__c=SLAEXPIRATIONDATE__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ShippingCountry=SHIPPINGCOUNTRY<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Fax=FAX<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Sic=SIC<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">NumberofLocations__c=NUMBEROFLOCATIONS__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">ShippingPostalCode=SHIPPINGPOSTALCODE<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Active__c=ACTIVE__C<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Ownership=OWNERSHIP<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">SLASerialNumber__c=SLASERIALNUMBER__C:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step5:<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Create another xml file named process-conf.xml. This file
will contain all the sales force related information. Following is the script
inside the process-conf file:<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><beans><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span><bean
id="PanelBookingUpsertfromDB"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">class="com.salesforce.dataloader.process.ProcessRunner"<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">singleton="false"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><description>Sample 'upsert'.</description><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="name"
value="PanelBookingUpsertfromDB"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><property name="configOverrideMap"><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><map><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.debugMessages"
value="true"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.debugMessagesFile"
value="LOGPATH"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.endpoint"
value="SalesForce site address."/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.username"
value="SalesForce ID"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><!-- password below has been encrypted using key file,
therefore it will not work without the key setting: process.encryptionKeyFile<o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">the password is not a valid encrypted value, please generate
the real value using encrypt.bat utility --><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.password" value="Place
your encripted value."/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="process.encryptionKeyFile"
value="Encripted key path"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.timeoutSecs"
value="600"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.loadBatchSize"
value="10000"/><span style="mso-tab-count: 4;"> </span><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 4;"> </span><entry
key="dataAccess.writeBatchSize" value="500" /><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 4;"> </span><entry
key="sfdc.bulkApiCheckStatusInterval" value="5000"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 4;"> </span><entry
key="sfdc.useBulkApi" value="true"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.externalIdField"
value="Salesforce external field."/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="sfdc.entity" value="SalesForce
entity name."/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="process.operation"
value="upsert"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="process.mappingFile"
value="mapping file path"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="dataAccess.name"
value="queryAccount"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="dataAccess.type"
value="databaseRead"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 4;"> </span><entry
key="process.outputSuccess" value="Success CSV path"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><span style="mso-tab-count: 4;"> </span><entry
key="process.outputError" value="Error CSV path."/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"><entry key="process.initialLastRunDate"
value="2005-12-01T00:00:00.000-0800"/><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></map><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></property><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></bean><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;"></beans><o:p></o:p></span></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<b style="mso-bidi-font-weight: normal;"><u><span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Step6:<o:p></o:p></span></span></u></b></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;"><span style="font-family: Calibri;">Put the following command inside a batch file and execute the
batch file from the SSIS package by using Execute process task. Which in turn
load the data into SalesForce.</span></span></div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com2tag:blogger.com,1999:blog-603751996912704303.post-53984073480858904592013-09-28T03:20:00.002-07:002013-09-30T09:25:44.681-07:00SalesForce Data comparator<div dir="ltr" style="text-align: left;" trbidi="on">
<h3>
Introduction:</h3>
Salesforce is one of the widely used CRM cloud system. Most of the times SalesForce will be the end point for the data and front end browser for the End user. So it is very important to verify that the data that resides inside SalesForce should be in the desired format. To ensure that the data comparison must be required between the source system and the SalesForce database.<br />
<br />
I will demonstrate you how can you perform the same by using .Net coding.<br />
<br />
<h3>
Pre-requisite:</h3>
Download the patner Web service from SalesForce website and add a reference to the .Net solution.<br />
<h3>
Code:</h3>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">PrivateSub</span><span style="font-family: Consolas; font-size: 9.5pt;">compare(srcQuery<span style="color: blue;">AsString</span>,
sfdcQuery<span style="color: blue;">AsString</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">stTime<span style="color: blue;">As</span><span style="color: #2b91af;">DateTime</span> = <span style="color: blue;">Date</span>.Now()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">dateCols<span style="color: blue;">AsNew</span><span style="color: #2b91af;">List</span>(<span style="color: blue;">OfString</span>)()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">edwExtra<span style="color: blue;">AsNew</span><span style="color: #2b91af;">List</span>(<span style="color: blue;">OfString</span>)()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">sfdcExtra<span style="color: blue;">AsNew</span><span style="color: #2b91af;">List</span>(<span style="color: blue;">OfString</span>)()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">numberCols<span style="color: blue;">AsNew</span><span style="color: #2b91af;">List</span>(<span style="color: blue;">OfString</span>)()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">boolCols<span style="color: blue;">AsNew</span><span style="color: #2b91af;">List</span>(<span style="color: blue;">OfString</span>)()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">detailMsg<span style="color: blue;">AsString</span> = <span style="color: #a31515;">""</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">shotMsg<span style="color: blue;">AsString</span> = <span style="color: #a31515;">""</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Try</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = <span style="color: #a31515;">"---------------------------------------------------"</span>&vbCrLf&<span style="color: #a31515;">"Summary"</span>&vbCrLf&<span style="color: #a31515;">"Entity: "</span>&<span style="color: #2b91af;">[Global]</span>.sfdcObjectName&vbCrLf&<span style="color: #a31515;">"Filter applied: "</span>&filterApplied&vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">sfdc = <span style="color: blue;">New</span><span style="color: #2b91af;">DataTable</span>()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"Comparision
starts for "</span> + objectName + <span style="color: #a31515;">"."</span>&vbCr&vbLf&<span style="color: #a31515;">"Fetching EDW records....."</span>&vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">src = da.GetDataTable(srcQuery, <span style="color: #2b91af;">[Global]</span>.srcConString)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">src.Rows.Count = 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = <span style="color: #a31515;">"No
EDW records present in the specified condition."</span>&vbCr&vbLf&<span style="color: #a31515;">"Please change the condition and try again."</span>&vbCr&vbLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"No
EDW records present in the specified condition."</span>&vbCr&vbLf&<span style="color: #a31515;">"Please change the condition and try again."</span>&vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"No EDW
records present in the specified condition."</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Return</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"EDW
records fetched:"</span> + src.Rows.Count.ToString() + vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = detailMsg&<span style="color: #a31515;">"Total
Records read from EDW: "</span>&src.Rows.Count.ToString() &vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">IfNot</span><span style="font-family: Consolas; font-size: 9.5pt;">login() <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">MessageBox</span><span style="font-family: Consolas; font-size: 9.5pt;">.Show(<span style="color: #a31515;">"Unable
to connect to SFDC."</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Return</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"Loged
in to SFDC."</span>&vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> des <span style="color: blue;">As</span><span style="color: #2b91af;">DescribeSObjectResult</span> = binding.describeSObject(<span style="color: #2b91af;">[Global]</span>.sfdcObjectName)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> fields <span style="color: blue;">As</span><span style="color: #2b91af;">Field</span>() = des.fields<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;"> field <span style="color: blue;">As</span><span style="color: #2b91af;">Field</span><span style="color: blue;">In</span> fields<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">field.type.ToString() = <span style="color: #a31515;">"boolean"</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">boolCols.Add(field.name)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">field.type.ToString() = <span style="color: #a31515;">"datetime"</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dateCols.Add(field.name)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">field.type.ToString() = <span style="color: #a31515;">"double"</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">numberCols.Add(field.name)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">binding.QueryOptionsValue = <span style="color: blue;">New</span><span style="color: #2b91af;">QueryOptions</span>()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">binding.QueryOptionsValue.batchSize = 2000<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">binding.QueryOptionsValue.batchSizeSpecified = <span style="color: blue;">True</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"Fetching
SalesForce records....."</span>&vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">qr<span style="color: blue;">As</span><span style="color: #2b91af;">QueryResult</span> = binding.query(sfdcQuery)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">qr.size = 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = <span style="color: #a31515;">"No
records present in SalesForce for the specified condition."</span>&vbCr&vbLf&<span style="color: #a31515;">"Please change the condition and try again."</span>&vbCr&vbLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"No
records present in SalesForce for the specified condition."</span>&vbCr&vbLf&<span style="color: #a31515;">"Please change the condition and try again."</span>&vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"No
records present in SalesForce for the specified condition."</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Return</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = detailMsg&<span style="color: #a31515;">"Total
Records read from SFDC: "</span>&qr.size.ToString() &vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> con <span style="color: blue;">As</span><span style="color: #2b91af;">sObject</span> = qr.records(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> done <span style="color: blue;">AsBoolean</span> = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">qr.size> 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">For</span><span style="font-family: Consolas; font-size: 9.5pt;">i<span style="color: blue;">AsInteger</span> = 0 <span style="color: blue;">To</span>con.Any.GetUpperBound(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> t <span style="color: blue;">As</span><span style="color: #2b91af;">Type</span> = <span style="color: blue;">GetType</span>(<span style="color: #2b91af;">[String]</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dateCols.Contains(con.Any(i).LocalName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>t = <span style="color: blue;">GetType</span>(<span style="color: #2b91af;">DateTime</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">numberCols.Contains(con.Any(i).LocalName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>t = <span style="color: blue;">GetType</span>(<span style="color: #2b91af;">[Double]</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">sfdc.Columns.Add(con.Any(i).LocalName, t)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">WhileNot</span><span style="font-family: Consolas; font-size: 9.5pt;"> done<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">For</span><span style="font-family: Consolas; font-size: 9.5pt;">i<span style="color: blue;">AsInteger</span> = 0 <span style="color: blue;">To</span>qr.records.GetUpperBound(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">con = qr.records(i)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">dr<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span> = sfdc.NewRow()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">For</span><span style="font-family: Consolas; font-size: 9.5pt;"> j <span style="color: blue;">AsInteger</span> = 0 <span style="color: blue;">To</span>con.Any.GetUpperBound(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dateCols.Contains(con.Any(j).LocalName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">con.Any(j).InnerText = <span style="color: #a31515;">""</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = <span style="color: #a31515;">"01-01-1900"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = <span style="color: #2b91af;">Convert</span>.ToDateTime(con.Any(j).InnerText)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ElseIf</span><span style="font-family: Consolas; font-size: 9.5pt;">numberCols.Contains(con.Any(j).LocalName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">con.Any(j).InnerText = <span style="color: #a31515;">""</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = <span style="color: #2b91af;">Convert</span>.ToDouble(con.Any(j).InnerText)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ElseIf</span><span style="font-family: Consolas; font-size: 9.5pt;">boolCols.Contains(con.Any(j).LocalName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">con.Any(j).InnerText = <span style="color: #a31515;">""</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = <span style="color: #2b91af;">Convert</span>.ToBoolean(con.Any(j).InnerText)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dr(j) = con.Any(j).InnerText<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">sfdc.Rows.Add(dr)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">qr.done<span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">done = <span style="color: blue;">True</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">qr = binding.queryMore(qr.queryLocator)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndWhile</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">MessageBox</span><span style="font-family: Consolas; font-size: 9.5pt;">.Show(<span style="color: #a31515;">"No
records found."</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"SalesForce
records fetched:"</span> + qr.size.ToString() + vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> ds <span style="color: blue;">AsNew</span><span style="color: #2b91af;">DataSet</span>()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">ds.Tables.Add(src)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">ds.Tables.Add(sfdc)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span><span style="color: blue;">In</span>ds.Tables(0).Rows<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> where <span style="color: blue;">AsString</span> = <span style="color: #a31515;">"["</span> + ds.Tables(1).Columns(0).ColumnName
+ <span style="color: #a31515;">"]='"</span> + dataRow(0).ToString() + <span style="color: #a31515;">"'"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">drL<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span>() = ds.Tables(1).[Select](where)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;"> (drL.Length = 0) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">edwExtra.Add(dataRow(0).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;"> s <span style="color: blue;">AsStringIn</span>edwExtra<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> where <span style="color: blue;">AsString</span> = <span style="color: #a31515;">"["</span> + ds.Tables(0).Columns(0).ColumnName
+ <span style="color: #a31515;">"]='"</span> + s + <span style="color: #a31515;">"'"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">drL<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span>() = ds.Tables(0).[Select](where)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">ds.Tables(0).Rows.Remove(drL(0))<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span><span style="color: blue;">In</span>ds.Tables(1).Rows<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> where <span style="color: blue;">AsString</span> = <span style="color: #a31515;">"["</span> + ds.Tables(0).Columns(0).ColumnName
+ <span style="color: #a31515;">"]='"</span> + dataRow(0).ToString() + <span style="color: #a31515;">"'"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">drL<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span>() = ds.Tables(0).[Select](where)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;"> (drL.Length = 0) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">sfdcExtra.Add(dataRow(0).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;"> s <span style="color: blue;">AsStringIn</span>sfdcExtra<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> where <span style="color: blue;">AsString</span> = <span style="color: #a31515;">"["</span> + ds.Tables(1).Columns(0).ColumnName
+ <span style="color: #a31515;">"]='"</span> + s + <span style="color: #a31515;">"'"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">drL<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span>() = ds.Tables(1).[Select](where)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">ds.Tables(1).Rows.Remove(drL(0))<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow_related<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span> = ds.Tables(0).NewRow()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">srcCol<span style="color: blue;">As</span><span style="color: #2b91af;">DataColumn</span> = ds.Tables(0).Columns(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">sfdcCol<span style="color: blue;">As</span><span style="color: #2b91af;">DataColumn</span> = ds.Tables(1).Columns(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRelation<span style="color: blue;">AsNew</span><span style="color: #2b91af;">DataRelation</span>(<span style="color: #a31515;">"EquiJoin"</span>,
srcCol, sfdcCol)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Try</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">ds.Relations.Add(dataRelation)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Catch</span><span style="font-family: Consolas; font-size: 9.5pt;"> e <span style="color: blue;">As</span><span style="color: #2b91af;">Exception</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">MessageBox</span><span style="font-family: Consolas; font-size: 9.5pt;">.Show(<span style="color: #a31515;">"SFDC
is having extra records."</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndTry</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">keyMatched<span style="color: blue;">As</span><span style="color: #2b91af;">Int32</span> = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">recsSynced<span style="color: blue;">As</span><span style="color: #2b91af;">Int32</span> = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> flag <span style="color: blue;">AsBoolean</span> = <span style="color: blue;">True</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow<span style="color: blue;">As</span><span style="color: #2b91af;">DataRow</span><span style="color: blue;">In</span>ds.Tables(1).Rows<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dataRow_related = dataRow.GetParentRow(<span style="color: #a31515;">"EquiJoin"</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">keyMatched += 1<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">For</span><span style="font-family: Consolas; font-size: 9.5pt;">i<span style="color: blue;">AsInteger</span> = 0 <span style="color: blue;">To</span>con.Any.GetUpperBound(0)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dateCols.Contains(sfdc.Columns(i).ColumnName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">TimeZoneInfo</span><span style="font-family: Consolas; font-size: 9.5pt;">.ConvertTimeToUtc(<span style="color: #2b91af;">Convert</span>.ToDateTime(dataRow(i))).ToString()
<><span style="color: #2b91af;">Convert</span>.ToDateTime(dataRow_related(i)).ToString()
<span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">addMismatch(objectName, src.Columns(0).ColumnName,
dataRow(0).ToString(), src.Columns(i).ColumnName,
dataRow_related(i).ToString(), sfdc.Columns(i).ColumnName, _<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">TimeZoneInfo</span><span style="font-family: Consolas; font-size: 9.5pt;">.ConvertTimeToUtc(<span style="color: #2b91af;">Convert</span>.ToDateTime(dataRow(i))).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">flag = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ElseIf</span><span style="font-family: Consolas; font-size: 9.5pt;">numberCols.Contains(sfdc.Columns(i).ColumnName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> d <span style="color: blue;">AsDouble</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow_related(i).ToString() = <span style="color: #a31515;">""</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>d = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>d = <span style="color: #2b91af;">Convert</span>.ToDouble(dataRow_related(i))<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">Convert</span><span style="font-family: Consolas; font-size: 9.5pt;">.ToDouble(dataRow(i)) <> d <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">addMismatch(objectName, src.Columns(0).ColumnName,
dataRow(0).ToString(), src.Columns(i).ColumnName, dataRow_related(i).ToString(),
sfdc.Columns(i).ColumnName, _<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dataRow(i).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">flag = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ElseIf</span><span style="font-family: Consolas; font-size: 9.5pt;">boolCols.Contains(sfdc.Columns(i).ColumnName) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> d <span style="color: blue;">AsBoolean</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow_related(i).ToString() = <span style="color: #a31515;">""</span><span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>d = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><span style="mso-spacerun: yes;"> </span>d = <span style="color: #2b91af;">Convert</span>.ToBoolean(dataRow_related(i))<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">Convert</span><span style="font-family: Consolas; font-size: 9.5pt;">.ToBoolean(dataRow(i)) <> d <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">addMismatch(objectName, src.Columns(0).ColumnName,
dataRow(0).ToString(), src.Columns(i).ColumnName,
dataRow_related(i).ToString(), sfdc.Columns(i).ColumnName, _<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dataRow(i).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">flag = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">dataRow(i).ToString()
<>dataRow_related(i).ToString() <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">addMismatch(objectName, src.Columns(0).ColumnName,
dataRow(0).ToString(), src.Columns(i).ColumnName, dataRow_related(i).ToString(),
sfdc.Columns(i).ColumnName, _<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">dataRow(i).ToString())<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">flag = <span style="color: blue;">False</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;"> (flag) <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">recsSynced += 1<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">flag = <span style="color: blue;">True</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = detailMsg&<span style="color: #a31515;">"Total
Keys Matched between EDW and SFDC: "</span>&keyMatched.ToString()
&vbCrLf&<span style="color: #a31515;">"Total Records Synched: "</span>&recsSynced.ToString()
&vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">edTime<span style="color: blue;">As</span><span style="color: #2b91af;">DateTime</span> = <span style="color: blue;">Date</span>.Now()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> TS <span style="color: blue;">As</span><span style="color: #2b91af;">TimeSpan</span> = edTime - stTime<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;"> hour <span style="color: blue;">AsInteger</span> =
TS.Hours<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">mins<span style="color: blue;">AsInteger</span> =
TS.Minutes<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">secs<span style="color: blue;">AsInteger</span> =
TS.Seconds<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">timeDiff<span style="color: blue;">AsString</span> =
((hour.ToString(<span style="color: #a31515;">"00"</span>) &<span style="color: #a31515;">":"</span>) + mins.ToString(<span style="color: #a31515;">"00"</span>) &<span style="color: #a31515;">":"</span>)
+ secs.ToString(<span style="color: #a31515;">"00"</span>)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = detailMsg&<span style="color: #a31515;">"Start
Time: "</span>&stTime.ToString() &vbCrLf&<span style="color: #a31515;">"End Time: "</span>&edTime.ToString()
&vbCrLf&<span style="color: #a31515;">"Run Time: "</span>&timeDiff&vbCrLf&<span style="color: #a31515;">"---------------------------------------------------"</span>&vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">textColor = <span style="color: #a31515;">"BLUE"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(detailMsg)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">mismatch.Rows.Count> 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">For</span><span style="font-family: Consolas; font-size: 9.5pt;">i<span style="color: blue;">AsInteger</span> = 0 <span style="color: blue;">To</span>mismatch.Rows.Count - 1<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: green; font-family: Consolas; font-size: 9.5pt;">'textLen = RichTextBox1.TextLength</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">textColor = <span style="color: #a31515;">"RED"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(<span style="color: #a31515;">"Key
not matched : "</span>&mismatch.Rows(i)(2).ToString() &<span style="color: #a31515;">" ,EDW "</span>&mismatch.Rows(i)(3).ToString()
&<span style="color: #a31515;">" : "</span>&mismatch.Rows(i)(4).ToString()
&<span style="color: #a31515;">" ,SFDC "</span>&mismatch.Rows(i)(5).ToString()
&<span style="color: #a31515;">" : "</span>&mismatch.Rows(i)(6).ToString()
+ vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: green; font-family: Consolas; font-size: 9.5pt;">'ea.Excelwriter(mismatch,
"Mismatch.xlsx", [Global].outputexcelPath)</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"Data
Consistency Check: Failed"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Else</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"Data
Consistency Check: Passed"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(vbCrLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">edwExtrapk<span style="color: blue;">AsString</span> = <span style="color: #a31515;">"Primary key of EDW Extra Records"</span>&vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Dim</span><span style="font-family: Consolas; font-size: 9.5pt;">sfdcExtrapk<span style="color: blue;">AsString</span> = <span style="color: #a31515;">"Primary key of SalesForce Extra Records"</span>&vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;"> s <span style="color: blue;">AsStringIn</span>edwExtra<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">edwExtrapk = edwExtrapk& s &vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">ForEach</span><span style="font-family: Consolas; font-size: 9.5pt;"> s <span style="color: blue;">AsStringIn</span>sfdcExtra<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">sfdcExtrapk = sfdcExtrapk& s &vbCrLf<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Next</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">edwExtra.Count> 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"Data
Consistency Check: Failed"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(edwExtrapk + vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">If</span><span style="font-family: Consolas; font-size: 9.5pt;">sfdcExtra.Count> 0 <span style="color: blue;">Then</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"Data
Consistency Check: Failed"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">AppendTextBox(sfdcExtrapk + vbCr&vbLf)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndIf</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;"><o:p> </o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">textColor = <span style="color: #a31515;">"BLACK"</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Catch</span><span style="font-family: Consolas; font-size: 9.5pt;"> e <span style="color: blue;">As</span><span style="color: #2b91af;">Exception</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">MessageBox</span><span style="font-family: Consolas; font-size: 9.5pt;">.Show(<span style="color: #a31515;">"An
unexpected error has occurred: "</span> + e.Message + vbLf + e.StackTrace)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">shotMsg = <span style="color: #a31515;">"Data
Consistency Check completed with errors."</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">detailMsg = <span style="color: #a31515;">"Data
Consistency Check completed with errors."</span><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">Finally</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;">MessageBox</span><span style="font-family: Consolas; font-size: 9.5pt;">.Show(shotMsg)<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">textLen = 0<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="font-family: Consolas; font-size: 9.5pt;">mismatch.Clear()<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndTry</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">EndSub</span></div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-32813048272995297562013-09-28T02:40:00.003-07:002013-09-30T13:07:00.657-07:00Splitting a Flat files to small files using SSIS Package<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
Introduction: </h3>
Its a common scenario when you have a huge flat file in GB containing millions of records and you want to split it into small files. There are different ways of doing the same. I will demonstrate you how you can spit the file by using SSIS.<br />
<br />
<h3 style="text-align: left;">
Method-1: By using For each loop, Conditional split and Row Number</h3>
<h4 style="text-align: left;">
Control Flow</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFJYERla_KXh5dnnqYpjbxhVoY-JDdvLCJrcA7Ffw_aYG2AcqqdLw0667Knza34SBs12cZi1cBZKxPkf45LEk6Cpkzwi_-TW8qflQDVeyR1lIXoGKRHGeHtAaW7_khmjcXWCsETFXCVuE/s1600/CapWorkFlowture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFJYERla_KXh5dnnqYpjbxhVoY-JDdvLCJrcA7Ffw_aYG2AcqqdLw0667Knza34SBs12cZi1cBZKxPkf45LEk6Cpkzwi_-TW8qflQDVeyR1lIXoGKRHGeHtAaW7_khmjcXWCsETFXCVuE/s1600/CapWorkFlowture.PNG" height="320" width="253" /></a></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
As you can see there are two Data Flow Tasks, one for loop container and two flat file connection managers are present.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Data Flow Task 1: DFT To get Source Count</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3BqoU-itRBF3I7EHUuqh-TsmsEqOZ_3TfTm0JJ5Zq3rf6J1seEDOGo4iHwJQjt7E4QjOERhCAzihm9MasZQ0inH_Om4HO6agsW4VfzDncSaZi-YIScjeILIekM9h17FWVExXwQr-Q0lY/s1600/Count+DataFLow.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3BqoU-itRBF3I7EHUuqh-TsmsEqOZ_3TfTm0JJ5Zq3rf6J1seEDOGo4iHwJQjt7E4QjOERhCAzihm9MasZQ0inH_Om4HO6agsW4VfzDncSaZi-YIScjeILIekM9h17FWVExXwQr-Q0lY/s1600/Count+DataFLow.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
This data flow is just to get the record count of the Big flat file. It has a Flat file source that reads data from the Big flat file and counts the row by using a row count transformation.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Variables</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifgrPUUe1WY30z3BALOv7f7A7JM38kETL6o3nxFxnPl_8vHIeU2PWKr76T51HUs683uVE700Q9avV3FbBbRY3v5UKa9TWaKhgRw67KTnsy20OZoMVEYC5mAXr3UCnc42En6jn6f-30cEA/s1600/variables.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifgrPUUe1WY30z3BALOv7f7A7JM38kETL6o3nxFxnPl_8vHIeU2PWKr76T51HUs683uVE700Q9avV3FbBbRY3v5UKa9TWaKhgRw67KTnsy20OZoMVEYC5mAXr3UCnc42En6jn6f-30cEA/s1600/variables.PNG" height="37" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRqKDcZNdLhbtZHzXlgq3kQ0gPkKhp4BFHzpUVVFjb-bV6SV7JEa8sjzpJuObXBXHluAb882t6lNb8frTYC6Q4afeT-DakUR4wYsLPHR7GuufLdyuh8SR9R0-5Oohyphenhyphen_4LsIaWYY7DC2U4/s1600/variables.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a> </div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
These are 4 variables:</div>
<ol>
<li><div style="text-align: left;">
Counter: Used as the Counter in for loop</div>
</li>
<li><div style="text-align: left;">
endCounter: Upper bound of the counter in for loop</div>
</li>
<li><div style="text-align: left;">
reCount: Store the record count of the Big flat file</div>
</li>
<li><div style="text-align: left;">
splitCount: Count of record to be present in each split files</div>
</li>
</ol>
<h4 style="text-align: left;">
For Loop Container</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDe-XV8l0naCKRxuQxsSlxUmbp8oR2AxlR63N_A1w2dUuMrMrO8R0CyvRMmsX0BHr7VNovwfVuQsrORM05hUZ4OvagLn5K5aAkVo3_QO3FdBrm5mUljLqzkRQC9spDMQzQJeK5l6hxb0/s1600/ForLoop.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibDe-XV8l0naCKRxuQxsSlxUmbp8oR2AxlR63N_A1w2dUuMrMrO8R0CyvRMmsX0BHr7VNovwfVuQsrORM05hUZ4OvagLn5K5aAkVo3_QO3FdBrm5mUljLqzkRQC9spDMQzQJeK5l6hxb0/s1600/ForLoop.png" height="271" width="320" /></a></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
This the condition placed inside for loop container.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Data Flow Task 2: Data File Splitter</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihofpxghRq-gCqWTW4Jj4geH8Wn8F7tLvTbqM4hHANW_tdAch-f3wN1guDFo8xx-peORN883_Z-SgC-o2Wh1tkEB18UulsdIe3NuQjI98uszaGzLP1y6sFY3FOnj1W9d9raVpf__8RlaY/s1600/Splitter+DFT.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihofpxghRq-gCqWTW4Jj4geH8Wn8F7tLvTbqM4hHANW_tdAch-f3wN1guDFo8xx-peORN883_Z-SgC-o2Wh1tkEB18UulsdIe3NuQjI98uszaGzLP1y6sFY3FOnj1W9d9raVpf__8RlaY/s1600/Splitter+DFT.PNG" height="320" width="149" /></a></div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
As you can see it fetches the data from the Big flat file and passes it through a Script Component which attach a row number to each of the records.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
This is the code present inside the Script component:</div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA-HhQGBgBSxXG4hg4MAY3x1r_Yt1liwAsmmxyK42jkcYBwvkWaRyUpipI0R73Z_Vt1ZyytAU3GKt3rDvnWiYOyMP0l1L6Ty60ojDScHmF0TlGSD_CVD8Oed67gXXfde3C9rg09xhlNSU/s1600/RowNumber.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA-HhQGBgBSxXG4hg4MAY3x1r_Yt1liwAsmmxyK42jkcYBwvkWaRyUpipI0R73Z_Vt1ZyytAU3GKt3rDvnWiYOyMP0l1L6Ty60ojDScHmF0TlGSD_CVD8Oed67gXXfde3C9rg09xhlNSU/s1600/RowNumber.PNG" height="180" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
Once the row number is attached a conditional split transformation spits the file according to the row number. Following is the condition present inside the conditional split transformation:</div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhb36IYRhF90i7cTB6Y0mgBxEaO9sHkGLFEv_v0AjV60aryFEkEB1-bQITD2Xfbdd_4f-vl3uBwtfC4gxnP8DYIy9eSHoEuVDB_dY5UaR0o622od4DnH2b068IUe8LkR01LoWVbIM6xUc/s1600/COndition.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhb36IYRhF90i7cTB6Y0mgBxEaO9sHkGLFEv_v0AjV60aryFEkEB1-bQITD2Xfbdd_4f-vl3uBwtfC4gxnP8DYIy9eSHoEuVDB_dY5UaR0o622od4DnH2b068IUe8LkR01LoWVbIM6xUc/s1600/COndition.PNG" height="21" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
After the file get spitted for the first cut it is being saved by a flat file destination. For each cut the flat file connection string changes dynamically and the flat file is saved with a different name. Following is the expression written inside the flat file destination for the Connection string property.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV9_mwiPMC9El_LhnJAMtxeMo6_kZsJg_M4a2Mzw5Nt2LHvbqKoDPrNMovhZtPy86ZLLk9rVFOcEGisCyMkFfVQNgrJcxiro_tF6y6Ddepm-HhPkT6YjO_ZDFfqTPrTylML65DP3pHMMg/s1600/Destination+Expression.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjV9_mwiPMC9El_LhnJAMtxeMo6_kZsJg_M4a2Mzw5Nt2LHvbqKoDPrNMovhZtPy86ZLLk9rVFOcEGisCyMkFfVQNgrJcxiro_tF6y6Ddepm-HhPkT6YjO_ZDFfqTPrTylML65DP3pHMMg/s1600/Destination+Expression.PNG" height="64" width="320" /></a></div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Pro</h4>
<div style="text-align: left;">
Simple easy to develop.</div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Con</h4>
<div style="text-align: left;">
Takes a lot of time.</div>
<h3 style="text-align: left;">
Method-2: By using Script Component</h3>
<h4 style="text-align: left;">
Control Flow</h4>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgwK58iSjhPVKjD_mcosXmsXmCLFr3OZ9pbazsl5OA8GnWE_2fXo_eHEaYX3KlhOyiCThiha6tCqnLNqB-1An-zbbt8cad5SjHo1_vRPCVPTHGRpD17NB7dcdoyBaEeX2x9Cd96-hjKm8/s1600/WFlow.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgwK58iSjhPVKjD_mcosXmsXmCLFr3OZ9pbazsl5OA8GnWE_2fXo_eHEaYX3KlhOyiCThiha6tCqnLNqB-1An-zbbt8cad5SjHo1_vRPCVPTHGRpD17NB7dcdoyBaEeX2x9Cd96-hjKm8/s1600/WFlow.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="text-align: left;">
Here as you can see there is only one data flow and inside that one flat file source is present. This flat file source fetches all the records from the file and passes it to a script component. The Script component splits the file into multiple flat files. Following code is present inside that:</div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">#region</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> Namespaces</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">using</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> System;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">using</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> System.Data;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">using</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
Microsoft.SqlServer.Dts.Pipeline.Wrapper;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">using</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> Microsoft.SqlServer.Dts.Runtime.Wrapper;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">using</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> System.IO;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">#endregion</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>[Microsoft.SqlServer.Dts.Pipeline.<span style="color: #2b91af;">SSISScriptComponentEntryPointAttribute</span>]</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">public</span><span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">class</span> <span style="color: #2b91af;">ScriptMain</span> :
<span style="color: #2b91af;">UserComponent</span></span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">{</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">string</span>
copiedAddressFile;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">private</span> <span style="color: #2b91af;">StreamWriter</span> textWriter;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">private</span> <span style="color: blue;">string</span> columnDelimiter = <span style="color: #a31515;">","</span>;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">private</span> <span style="color: blue;">string</span> filepath = <span style="color: #a31515;">@"C:\Work
Area\Innovation\Flatfile spit on a fly\test.txt"</span>;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">private</span> <span style="color: blue;">string</span>[] columns;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span>
PreExecute()</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: #2b91af;">IDTSInput100</span> input = ComponentMetaData.InputCollection[0];</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> columns = <span style="color: blue;">new</span> <span style="color: blue;">string</span>[input.InputColumnCollection.Count];</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">for</span> (<span style="color: blue;">int</span> i = 0; i
< input.InputColumnCollection.Count; i++)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"><span style="mso-spacerun: yes;"> </span>
columns[i] = input.InputColumnCollection[i].Name;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span>
PostExecute()</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">public</span>
<span style="color: blue;">override</span> <span style="color: blue;">void</span>
AcquireConnections(<span style="color: blue;">object</span> Transaction)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span>
ProcessInput(<span style="color: blue;">int</span> InputID,
Microsoft.SqlServer.Dts.Pipeline.<span style="color: #2b91af;">PipelineBuffer</span>
buffer)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> <span style="color: blue;">while</span> (buffer.NextRow())</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (buffer[columns.Length-1].ToString() == <span style="color: #a31515;">"1"</span>)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
filepath = <span style="color: #a31515;">@"C:\Work Area\Innovation\Flatfile
spit on a fly\test"</span> + <span style="color: #2b91af;">Convert</span>.ToString(<span style="color: #2b91af;">Convert</span>.ToInt32(buffer[columns.Length - 1]) - 1) +
<span style="color: #a31515;">".txt"</span>;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter = <span style="color: blue;">new</span> <span style="color: #2b91af;">StreamWriter</span>(filepath,
<span style="color: blue;">false</span>);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">for</span> (<span style="color: blue;">int</span> i = 0;
i < columns.Length; i++)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
{</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(columns[i]);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (i != columns.Length - 1)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(columnDelimiter);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
}</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.WriteLine();</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (<span style="color: #2b91af;">Convert</span>.ToInt32(buffer[columns.Length
- 1]) % 2000000 == 1)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> {</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Close();</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
filepath = <span style="color: #a31515;">@"C:\Work Area\Innovation\Flatfile
spit on a fly\test"</span> + <span style="color: #2b91af;">Convert</span>.ToString(<span style="color: #2b91af;">Convert</span>.ToInt32(buffer[columns.Length - 1]) - 1) +
<span style="color: #a31515;">".txt"</span>;</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter = <span style="color: blue;">new</span> <span style="color: #2b91af;">StreamWriter</span>(filepath,
<span style="color: blue;">false</span>);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">for</span> (<span style="color: blue;">int</span> i = 0;
i < columns.Length; i++)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
{</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(columns[i]);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (i != columns.Length - 1)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(columnDelimiter);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
}</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.WriteLine();</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">for</span> (<span style="color: blue;">int</span> j = 0;
j < columns.Length; j++)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
{</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(buffer[j]);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (j != columns.Length-1)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Write(columnDelimiter);</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">else</span></span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.WriteLine();</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
}</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
<span style="color: blue;">if</span> (buffer[columns.Length - 1].ToString() == <span style="color: #a31515;">"10000000000000"</span>)</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">
textWriter.Close(); </span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";"> }</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-fareast-font-family: "Times New Roman";">}</span><span style="mso-ascii-font-family: Calibri; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman"; mso-hansi-font-family: Calibri;"><o:p></o:p></span></div>
<div style="text-align: left;">
</div>
<h4 style="text-align: left;">
Pros</h4>
<div style="text-align: left;">
Faster to split the file.</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com16tag:blogger.com,1999:blog-603751996912704303.post-86414668765583448722013-09-27T10:23:00.002-07:002016-05-03T08:35:28.133-07:00Dynamically creating SSIS packages<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Introduction: According to an old adage:<br />
<br />
'If you want to write a code then you should write a code that will write your code instead.'<br />
<br />
For a SSIS developer it's a fairy tell, if he can create 100 of packages just clicking a button. Yes this fairy tell can come true and I will show you how.<br />
<br />
Lot of times in real working scenario it happens like a developer need to create same kind of packages for number tables. Initially it's interesting but the interest goes down gradually over the period of time due to repeating work. Lack of interest leads to manual error and rework. The package creation should be automated to avoid such unwanted situations.<br />
<br />
Technology Required: C# and Knowledge on SSIS.<br />
<br />
The DLLS used over here are SQL Server related DLLS. These DLLs will only be present if you have SQL Server installed on your system.<br />
<br />
<strong>Reading a package present in file system:</strong><br />
<br />
<span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">using</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime;</span></span><br />
<span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">public</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.Package ReadPackage(</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> packagePath)</span></span><br />
<br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">{<br />
</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.Application app = </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">new</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.Application();</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.Package package = </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">new</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.Package();</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> package = app.LoadPackage(packagePath, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">null</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">return</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> package;</span></span><br />
<span style="font-family: "consolas";"><br />
<span style="font-family: "consolas";">
<br />
}</span><br />
<span style="font-family: "consolas";"><br />
</span></span><strong>Modifying SSIS OLEDB Connection manager dynamically:</strong><br />
<br />
Code:<br />
<br />
<span style="font-family: "consolas";"><span style="color: blue;">using</span> Microsoft.SqlServer.Dts.Runtime;</span> <span style="font-family: "consolas";">
</span><br />
<span style="font-family: "consolas";"> <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">public</span></span></span> Microsoft.SqlServer.Dts.Runtime.Package modifyOLEDBConnection(Microsoft.SqlServer.Dts.Runtime.Package package, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> oldConName, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> newConName, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> connectionString)</span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{<br />
ConnectionManager conmgr = package.Connections[oldConName];
<br />
conmgr.Name = newConName;<br />
</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.ConnectionString = connectionString;</span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">// Global.SSISConnectionString;</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">return</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> package;</span></span><br />
<span style="font-family: "consolas";">
<span style="font-family: "consolas";">
}</span></span><br />
<br />
<strong> </strong></div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-44428115-1', 'radhajyotsna0.blogspot.in');
ga('send', 'pageview');
</script><strong>Modifying SSIS Configurations:</strong><br />
<br />
<span style="font-family: "consolas"; font-size: x-small;">
<span style="font-size: small;"><span style="color: blue;">using</span> Microsoft.SqlServer.Dts.Runtime;</span></span><br />
<br />
<span style="font-family: "consolas";"> <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">public</span></span></span> <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">void</span></span></span> modifyConfig(Package package, string oldName, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> name, DTSConfigurationType type, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> setting, <span style="color: blue;"><span style="color: blue;"><span style="color: blue;">string</span></span></span> target)</span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{
<br />
Configurations configurations = package.Configurations;
<br />
Microsoft.SqlServer.Dts.Runtime.Configuration configuration;<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> configuration = configurations[</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"><span style="font-family: "consolas";">oldName</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">];</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
configuration.Name = name;
<br />
configuration.ConfigurationType = type;
<br />
configuration.ConfigurationString = setting;
<br />
configuration.PackagePath = target;
<br />
}</span> </span><br />
<br />
<strong></strong><br />
<strong>Modifying Union All:</strong><br />
<br />
<span style="color: blue; font-family: "consolas"; font-size: x-small;"><span style="color: blue; font-family: "consolas"; font-size: x-small;"><span style="color: blue; font-family: "consolas"; font-size: x-small;"></span></span></span><br />
<span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">using</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Pipeline.Wrapper;</span></span><br />
</span></span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">public</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> IDTSComponentMetaData100 dfModifyUnionAllMapping(IDTSComponentMetaData100 unionAll,</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> inputIndex,</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> inputColumnName,</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> outputColumnName)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{
<br />
IDTSInput100 destInput = unionAll.InputCollection[inputIndex];<br />
IDTSVirtualInput100 destVirInput = destInput.GetVirtualInput();<br />
CManagedComponentWrapper instanceUnionAll = unionAll.Instantiate();<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> inputColumnLen=0;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">foreach</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (IDTSVirtualInputColumn100 vColumn </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">in</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> destVirInput.VirtualInputColumnCollection)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (vColumn.Name.ToUpper() == inputColumnName.ToUpper())</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{
<br />
instanceUnionAll.SetUsageType(
<br />
destInput.ID, destVirInput, vColumn.LineageID, DTSUsageType.UT_READONLY);<br />
<br />
inputColumnLen=vColumn.Length;
<br />
}
<br />
}<br />
</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">IDTSInputColumn100 inputCol = </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">null</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">for</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> i = 0; i < unionAll.InputCollection[inputIndex].InputColumnCollection.Count; i++)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (unionAll.InputCollection[inputIndex].InputColumnCollection[i].Name.ToUpper() == inputColumnName.ToUpper())</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
inputCol = unionAll.InputCollection[inputIndex].InputColumnCollection[i];<br />
<br />
}</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> outputLID = 0;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">for</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> i = 0; i < unionAll.OutputCollection[0].OutputColumnCollection.Count; i++)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (unionAll.OutputCollection[0].OutputColumnCollection[i].Name.ToUpper() == outputColumnName.ToUpper())</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{
<br />
outputLID = unionAll.OutputCollection[0].OutputColumnCollection[i].LineageID;<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (unionAll.OutputCollection[0].OutputColumnCollection[i].Length < inputColumnLen)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
unionAll.OutputCollection[0].OutputColumnCollection[i].SetDataTypeProperties(unionAll.OutputCollection[0].OutputColumnCollection[i].DataType, inputColumnLen, unionAll.OutputCollection[0].OutputColumnCollection[i].Precision, unionAll.OutputCollection[0].OutputColumnCollection[i].Scale, unionAll.OutputCollection[0].OutputColumnCollection[i].CodePage);
<br />
} <br />
<br />
}<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">for</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> i = 0; i < unionAll.InputCollection[inputIndex].InputColumnCollection.Count; i++)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
{<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (unionAll.InputCollection[inputIndex].InputColumnCollection[i].CustomPropertyCollection[0].Value == outputLID)</span></span><span style="font-family: "consolas";">
<span style="font-family: "consolas";">
<br />
unionAll.InputCollection[inputIndex].InputColumnCollection.RemoveObjectByID(unionAll.InputCollection[inputIndex].InputColumnCollection[i].ID);<br />
</span> </span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (unionAll.InputCollection[inputIndex].InputColumnCollection[i].Name.ToUpper() == inputColumnName.ToUpper())</span></span><span style="font-family: "consolas";"><br />
<span style="font-family: "consolas";">
<br />
unionAll.InputCollection[inputIndex].InputColumnCollection[i].CustomPropertyCollection[0].Value = outputLID;<br />
<br />
}</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> r</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">eturn</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> unionAll;</span></span><span style="font-family: "consolas"; font-size: x-small;"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
}</span><br />
<br />
</span></span><br />
<span style="font-family: "consolas"; font-size: x-small;"><span style="font-family: Times, "Times New Roman", serif; font-size: small;"><strong>Modifying Execute SQL Task:</strong></span><br />
<br />
<span style="font-size: small;"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">using</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> System.Threading.Tasks;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">public</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Package EditExecuteSQL(Package package,</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> componentName,</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> query) </span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{
<br />
Executable executeSql = package.Executables[componentName]; <br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.TaskHost taskhostexecuteSql = executeSql </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">as</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Microsoft.SqlServer.Dts.Runtime.TaskHost;</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> taskhostexecuteSql.Properties[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"SqlStatementSource"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].SetValue(taskhostexecuteSql, query);</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">return</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> package;</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-family: "consolas"; font-size: small;">
<br />
}</span></span><br /><span style="font-size: small;">
</span><br />
<span style="font-family: Times, "Times New Roman", serif; font-size: small;"><strong>Create Flat file connection:<br />
</strong></span><br /><span style="font-size: small;">
<span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">public</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> Package CreateFlatFileConnection(Microsoft.SqlServer.Dts.Runtime.Package package, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strConName, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strConnectionString, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strSchemaTabName)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{</span></span></span><span style="font-size: small;"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">try</span></span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
{
<br />
DataTable dt = da.GetColumnsandDataType(strSchemaTabName,strConnectionString);
<br />
ConnectionManager conmgr;
<br />
</span></span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";">conmgr = package.Connections.Add(</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"FLATFILE"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
conmgr.Name = strConName;<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Setting the Unicode, CodePage and Connection string properties of the Connection manager</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.Properties[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"Unicode"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].SetValue(conmgr, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">true</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.Properties[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"CodePage"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].SetValue(conmgr, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">true</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span>
</span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
conmgr.ConnectionString = strConnectionString;
<br />
<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strDestTabName = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">""</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span>
</span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
DtsProperties connProperties = conmgr.Properties;<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">/* Setting FlatFile Properites*/</span></span></span>
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">const</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> quote = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"\""</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Removing schema part from the table</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strDestTabName = strSchemaTabName.Substring(strSchemaTabName.IndexOf(</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"."</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">) + 1, strSchemaTabName.Length - strSchemaTabName.IndexOf(</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"."</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">) - 1);</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
<br />
</span></span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> str1 = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"@[User::FilePath]+"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"\\\\"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + Global.sourceSystem + strDestTabName + Global.destinationSystem + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"+ replace(replace(replace((DT_WSTR,30) (DT_DBTIMESTAMP) @[System::StartTime],"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"-"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">","</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">" "</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"),"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">":"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">","</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">" "</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"),"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">" "</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">","</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">""</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">")+"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote + </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">".dat"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> + quote;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Setting the ColumnNamesInFirstDataRow property</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.Properties[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"ColumnNamesInFirstDataRow"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].SetValue(conmgr, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">false</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Setting the expression for the Connection String property</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.Properties[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"ConnectionString"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].SetExpression(conmgr, str1);</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> conmgr.AcquireConnection(</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">null</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">/*Getting the Output Column*/</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (conmgr.InnerObject != </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">null</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSConnectionManagerFlatFile100 connectionFlatFileDestionation = conmgr.InnerObject </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">as</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSConnectionManagerFlatFile100;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> i = 0;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//RuntimeWrapper.DataType </span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">foreach</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (DataRow row </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">in</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> dt.Rows)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSConnectionManagerFlatFileColumn100 flatFileCol = connectionFlatFileDestionation.Columns.Add() </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">as</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSConnectionManagerFlatFileColumn100;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSName100 columnName = flatFileCol </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">as</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> RuntimeWrapper.IDTSName100;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">/*Setting Column Properties*/</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> columnName.Name = row[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"ColumnName"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].ToString();</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (i == dt.Rows.Count - 1)</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionFlatFileDestionation.Columns[i].ColumnDelimiter = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"\r\n"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">else</span></span></span><br />
<span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionFlatFileDestionation.Columns[i].ColumnDelimiter = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"|"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionFlatFileDestionation.Columns[i].DataType = GetSSISDataType(row[</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"TypeName"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">].ToString());</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionFlatFileDestionation.Columns[i].TextQualified = </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">true</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionFlatFileDestionation.Columns[i].ColumnType = </span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"Delimited"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">;</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;"><span style="font-family: "consolas";"> <br />
<br />
i++;<br />
<br />
} <br />
<br />
}<br />
<br />
}<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">catch</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: #2b91af; font-family: "consolas";"><span style="color: #2b91af; font-family: "consolas";"><span style="color: #2b91af; font-family: "consolas";">Exception</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> ex)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//MessageBox.Show("Error in Creating Flatfile Connection or setting its properties");</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span>
</span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-family: "consolas";"><span style="font-size: small;">
}<br />
</span></span><span style="font-size: small;"> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">return</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> package;</span></span><br />
<br />
</span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
</span><span style="font-family: "consolas"; font-size: small;">
<br />
}</span></span><br />
<br />
<span style="font-family: Times, "Times New Roman", serif; font-size: small;"><strong>Modify OLEDB Connection:<br />
</strong></span><br />
<span style="font-size: small;"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">public</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> IDTSComponentMetaData100 dfModifyOLEdbSource(Package package, IDTSComponentMetaData100 oledbSource, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> connectionMgrName, </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> strSQLCommand, List<</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">string</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">> sortKeyPositions)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{
<br />
CManagedComponentWrapper instanceSource = oledbSource.Instantiate();<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//setting Connection Manager Informations</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (oledbSource.RuntimeConnectionCollection.Count > 0)</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{
<br />
oledbSource.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(package.Connections[connectionMgrName]); <br />
<br />
oledbSource.RuntimeConnectionCollection[0].ConnectionManagerID = package.Connections[connectionMgrName].ID;
<br />
}<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Setting OLEDB source properties</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> instanceSource.SetComponentProperty(</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"AccessMode"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">, 2);</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> instanceSource.SetComponentProperty(</span></span><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";"><span style="color: #a31515; font-family: "consolas";">"SqlCommand"</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">, strSQLCommand);</span></span>
<span style="font-family: "consolas";"><span style="font-family: "consolas";">
</span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> instanceSource.AcquireConnections(</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">null</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";">);</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
instanceSource.ReinitializeMetaData();
<br />
instanceSource.ReleaseConnections();<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">//Setting sort key positions</span></span></span><br />
<span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";"><span style="color: green; font-family: "consolas";">
</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"></span></span><br />
<span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">for</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> i = 0; i < sortKeyPositions.Count; i++)</span></span></span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">for</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (</span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">int</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> j = 0; j < oledbSource.OutputCollection[0].OutputColumnCollection.Count; j++)</span></span>
</span><span style="font-family: "consolas";"><br /><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
{<br />
</span> </span></span><span style="font-size: small;"><span style="font-family: "consolas";"><span style="font-family: "consolas";"> </span></span><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">if</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> (oledbSource.OutputCollection[0].OutputColumnCollection[j].Name == sortKeyPositions[i])</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-size: small;"><span style="font-family: "consolas";">
<br />
oledbSource.OutputCollection[0].OutputColumnCollection[j].SortKeyPosition = i + 1;
<br />
}
<br />
}<br />
</span></span></span><span style="font-size: small;"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";"><span style="color: blue; font-family: "consolas";">return</span></span></span><span style="font-family: "consolas";"><span style="font-family: "consolas";"> oledbSource;</span></span></span><span style="font-family: "consolas";"><span style="font-size: small;">
</span><span style="font-family: "consolas"; font-size: small;">
<br />
}</span></span></span></div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com0tag:blogger.com,1999:blog-603751996912704303.post-26978969491704438272013-09-27T10:07:00.000-07:002013-09-28T23:38:22.826-07:00SQL Server, SSIS and SSRS interview questions<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<span style="font-family: inherit;"><strong>Please leave your valuable comments so that we can improve.</strong> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">1. What is Index? What are the types of Index? Please Explain.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Ans. Index is a faster way of doing lookup with data based on the values within those columns.</span><br />
<span style="font-family: inherit;">If we create an index on the primary key and then search for a row of data based on one of the primary key values, SQL Server finds that value in the index and then uses the index to locate the entire row.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">An Index is made up of a set of pages(index nodes) that are organized in a b-tree hierarchical structure, starting from the root node and ending at the leaf nodes. Each node contains a double linked list.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">We cant create indexes on LOB data types such as Image,Text or nvarchar(max).</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Clustered Index :-contains the actual data rows at the leaf node of the Index. Index values are always sorted in ascending or descending order. That's why only 1 clustered index is possible.</span><br />
<span style="font-family: inherit;">Non Clustered Index :-contains a reference to the index in case of a clustered table or a rowlocator in case of heap(non clustered view or table).Max no in case of SQLserver 2005 :-249,Max no in case of SQLServer 2008 :-999</span><br />
<span style="font-family: inherit;">A Non-Clustered Index you will use alongside a clustered index to improve read performance. You should put these on columns used in WHERE Clause, JOIN, etc. and can include other columns that the query needs, to enhance performance even more. This is called a "covering index".</span><br />
<span style="font-family: inherit;">Disadvantage:-Slows down the Insert, Update or Delete. Non Clustered will occupy more disk space. </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">2. What is table Partition?</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Ans. When a database table grows in size to the hundreds of gigabytes or more, it can become more difficult to load new data, remove old data, and maintain indexes. Just the sheer size of the table causes such operations to take much longer. Even the data that must be loaded or removed can be very sizable, making INSERT and DELETE operations on the table impractical. The Microsoft SQL Server 2008 database software provides table partitioning to make such operations more manageable.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Partitioning a large table divides the table and its indexes into smaller partitions, so that maintenance operations can be applied on a partition-by-partition basis, rather than on the entire table. In addition, the SQL Server optimizer can direct properly filtered queries to appropriate partitions rather than the entire table.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Benefits :-Performance,Parallelism</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Right Click the table ,Storage,Create Partition,Create Partition Wizard will appear,Next,Give Partition Function name,Give Partition Scheme name,Mapping,option to create script or run or Schedule</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Window Functions provide results for each row in the dataset.For Eg : Row_Number(),Rank() and Dense_Rank().</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Group by provides one aggregated value for one dataset but Partition by provides value for each of the row in the data set.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">3. What is JOIN in SQL Server?</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Ans. Join is the process of joining two or more tables or views on the basis of a relationship to get a desired output result set.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> It's of three types:</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">1. Inner Join</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">2. Outer Join</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> a. Left outer Join</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> b. Right outer Join</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> c. Full outer Join</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Inner Join: The rows of the tables those passing the join condition will be the output of the Inner Join.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"> </span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Outer Join: </span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Left Outer Join: It will give all the records of the Left table and the only those rows from the right table that pass the Join condition.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Right Outer Join: It will give all the records of the Right table and only those tables from the left table that pass the Join condition.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Full Outer Join: It will give all the records from Right table and Left table.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">4. How to delete duplicate rows in SQL Server?</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Ans. Two ways to delete duplicate rows in SQL Server:</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">1. Using %%physloc%% pseudo column.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">The %%physloc%% pseudo column holds the physical location of the row. you can take the max of the column and delete the rest.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">2. Using Common Table Expression(CTE)</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Create a CTE on the table and create a row number column for the table grouping by all columns. Then, take the max row number row alone and delete the rest.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">5. What is Common Table Expression(CTE)?</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Ans. Common Table Expression or CTE allows us to write a query and name it using an alias and later refer the same data using the alias name just as a table. The changes made to the alias are reflected in the base table.</span><br />
<span style="font-family: inherit;">Advantages:-</span><br />
<span style="font-family: inherit;">1)When lot of Sub-queries are involved, then CTE can put each sub-query as a temp table and these temp tables can be referred afterwards.</span><br />
<span style="font-family: inherit;">2)Readability</span><br />
<span style="font-family: inherit;">3)Recursive Query can be achieved</span><br />
<span style="font-family: inherit;">3)Calculated Fields like Row number, Rank and Dense Rank can be stored in CTE.</span><br />
<span style="font-family: inherit;">4)When we don't want a view to be in Metadata, we can use CTE.</span><br />
<span style="font-family: inherit;">5)Looping</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">Syntax:</span><br />
<span style="font-family: inherit;">With Temp_Table_Name (Col1,Col2) as (Query_String)</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">After the above statement, we can write a query referring to the above Temp_Table_Name.</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;"></span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6. How to send Multivalued Parameter to a procedure from
SSRS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Parameter -Multivalued,In the dataset,Stored Procedure
to be chosen from drop-down,Click Parameters,Go to expression and type
join(Parameter,delimiter).In the SP,we have to use a table valued split
function after IN.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">7. 1 million records are coming from Source.after 10000
records not matching in the look up,we want to fail the package.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Ans. Use Row Count
and FailPackageonFailure Expression on the task</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">8. How to delete duplicate records in Sql Server 2008?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. %%physloc%% is a pseudocolumn that gives the physical
location of every row(or ROW_ID).</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">With temp table name will re-generate the same table with
additional column, which is row number. In our case, we have Col1 and Col2 and
both the columns qualify as duplicate rows. It may be a different set of rows
for each different query like this. Another point to note here is that once CTE
is created<span style="mso-spacerun: yes;"> </span>DELETE statement can be run
on it. We will put a condition here – when we receive more than one rows of
record, we will remove the row which is not the first one. When DELETE command
is executed over CTE it in fact deletes from the base table used in CTE.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">10. What is Common Table Expression(CTE) ?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Common Table Expression or CTE allows us to write a
query and name it using an alias and later refer the same data using the alias
name just as a table.The changes made to the alias are reflected in the base
table.Advantages:-</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)When lot of Subqueries are involved,then CTE can put each
subquery as a temp table and these temp tables can be referred afterwards.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Readability</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Recursive Query can be achieved</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Calculated Fields like Rownumber,Rank and Dense Rank can
be stored in CTE.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)When we dont want a view to be in Metadata,we can use CTE.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)Looping</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">With Temp_Table_Name (Col1,Col2) as (Query_String)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">After the above statement,we can write a query referring to
the above query."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">11. Explain different types of Ranking Functions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Ranking Functions return a ranking value for each row
in a partition. Ranking Functions are Row_Number(),Rank(),Dense_Rank() and
NTILE().</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Row_Number() function returns a unique ranking value for
each row irrespective of whether Order by Value is a tie or not.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Dense Rank() function is same as Row_Number() but it
provides the same ranking value to rows in case of ties in the Order by Values.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Rank() function returns the ranking value as 1+No of ranks
that come before the row in question.Thats why Rank function does not always
return consecutive integers.The ranking value depends on how the rows appear in
the result set. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">NTILE(integer) over (partition by-order by) function
distributes the rows in an ordered partition into a specified number of
groups.The groups are numbered, starting at one. For each row, NTILE returns
the number of the group to which the row belongs.If the number of rows in a
partition is not divisible by integer_expression, this will cause groups of two
sizes that differ by one member. Larger groups come before smaller groups in
the order specified by the OVER clause. For example if the total number of rows
is 53 and the number of groups is five, the first three groups will have 11
rows and the two remaining groups will have 10 rows each. If on the other hand
the total number of rows is divisible by the number of groups, the rows will be
evenly distributed among the groups. For example, if the total number of rows
is 50, and there are five groups, each bucket will contain 10 rows.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Example of Ranking Functions<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">C1 <span style="mso-tab-count: 1;"> </span>RN <span style="mso-tab-count: 1;"> </span>DR<span style="mso-spacerun: yes;">
</span><span style="mso-tab-count: 1;"> </span>R <span style="mso-tab-count: 1;"> </span>NTILE(3)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">10 <span style="mso-tab-count: 1;"> </span>1<span style="mso-tab-count: 1;"> </span> 1 <span style="mso-tab-count: 1;"> </span>1 <span style="mso-tab-count: 1;"> </span>1</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">20 <span style="mso-tab-count: 1;"> </span>2 <span style="mso-tab-count: 1;"> </span>2<span style="mso-tab-count: 1;"> </span>
2<span style="mso-tab-count: 1;"> </span> 1</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">20 <span style="mso-tab-count: 1;"> </span>3 <span style="mso-tab-count: 1;"> </span>2<span style="mso-tab-count: 1;"> </span>
2<span style="mso-tab-count: 1;"> </span> 1</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">30 <span style="mso-tab-count: 1;"> </span>4 <span style="mso-tab-count: 1;"> </span>3<span style="mso-tab-count: 1;"> </span>
4<span style="mso-tab-count: 1;"> </span> 2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">30 <span style="mso-tab-count: 1;"> </span>5 <span style="mso-tab-count: 1;"> </span>3<span style="mso-tab-count: 1;"> </span>
4<span style="mso-tab-count: 1;"> </span> 2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">40 <span style="mso-tab-count: 1;"> </span>6 <span style="mso-tab-count: 1;"> </span>4<span style="mso-tab-count: 1;"> </span>
6 <span style="mso-tab-count: 1;"> </span>2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">40 <span style="mso-tab-count: 1;"> </span>7 <span style="mso-tab-count: 1;"> </span>4<span style="mso-tab-count: 1;"> </span>
6 <span style="mso-tab-count: 1;"> </span>3</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">40 <span style="mso-tab-count: 1;"> </span>8 <span style="mso-tab-count: 1;"> </span>4<span style="mso-tab-count: 1;"> </span>
6<span style="mso-tab-count: 1;"> </span> 3</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">50 <span style="mso-tab-count: 1;"> </span>9 <span style="mso-tab-count: 1;"> </span>5<span style="mso-tab-count: 1;"> </span>
9<span style="mso-tab-count: 1;"> </span> 3</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">C1-Column name</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">RN-Row Number</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">DR-Dense_Rank</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">R-Rank</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">NTILE-NTILE</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">13. How to get the nth Maximum id in Sql Server 2008?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Top N * over descending Column dataset having
distinct,Then do select top 1 * from (Earlier Dataset)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">14. How to get the department name having the nth Maximum id
in Sql Server 2008?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Use Dense_Rank over (order by id) and store it in a
temp table using CTE.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Then Select from the temptable where rank=n"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">15. How to get the 5th Maximum Salary for each
department?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Use Dense_Rank over (Partition by department order by
Salary) and store it in a temp table using CTE.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Then Select from the temptable where rank=n</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Remember:-Partition divides the result set into different
groups or partitions first and then Order By returns the ranking for each row
inside the Partition based on the column value."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">16. How to get Cumulative Sum of a column over a period of
time?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)Using Self Join :-</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select r1.priority_key,r1.colour,SUM(r2.priority_key) </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from Rep_Priority_Colour r1,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Rep_Priority_Colour r2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">where</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">r2.priority_key <= r1.priority_key</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">group by</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">r1.priority_key,r1.colour</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">order by r1.priority_key (By using self join)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)<span style="mso-tab-count: 1;"> </span>Using
Nested Sub-Query:-</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">SELECT DayCount,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Sales,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;">
</span>Sales+COALESCE((SELECT SUM(Sales) </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;">
</span>FROM Sales b </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;">
</span>WHERE b.DayCount < a.DayCount),0)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;">
</span>AS RunningTotal</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">FROM Sales a</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">ORDER BY DayCount</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)<span style="mso-tab-count: 1;"> </span>Using
Cursor(A table variable and a variable RunningTotal=RunningTotal+Column value
inside While )</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)<span style="mso-tab-count: 1;"> </span>Using
Cross apply also we can get that"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">17. What is Correlated SubQuery?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Correlated SubQuery means Repeated Subquery.For each
row returned by the parent or outer query,the subquery executes .The subquery depends
on the outer query for its values.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Eg:select * from dbo.FactTicket where exists (select
Priority_key from DimTicketPriority where
Priority_key=FactTicket.Priority_key)"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">18. How to get the last day of the week or first day of the
week?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1) Take a reference 0.Do Datediff(ww,0,getdate()) which
will give the difference between the reference and getdate() in terms of weeks.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2) If we want current week's,then do
Datediff(ww,0,getdate())+0 or for current week+n do
Datediff(ww,0,getdate())+n.This is nothing but the number of weeks from the
reference.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Dateadd(ww,Datediff(ww,0,getdate())+n,0) will give us the
first day of nth week after Current month.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)To get the last day for (n-1) week,we can do
Dateadd(s,-1,Dateadd(ww,Datediff(ww,0,getdate())+n,0))</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">19. How to get the last day of the month or first day of the
month?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1) Take a reference 0.Do Datediff(mm,0,getdate()) which
will give the difference between the reference and getdate() in terms of
months.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2) If we want current month's,then do Datediff(mm,0,getdate())+0
or for current month+n do Datediff(mm,0,getdate())+n.This is nothing but the
number of months from the reference.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Dateadd(mm,Datediff(mm,0,getdate())+n,0) will give us the
first day of nth month after Current month.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)To get the last day for (n-1) month,we can do
Dateadd(s,-1,Dateadd(mm,Datediff(mm,0,getdate())+n,0))</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Same Rule applies for first day and last day of any
datepart.Datepart Syntax:Datepart(mm,getdate())</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">20. Difference between Index Scan and Index Seek Scan?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. In Index scan, SQL Server reads the whole of the index
looking for matches. Time taken is proportional to the index size.In Index Seek
Scan,SQL Server uses the b-tree structure of the index to seek directly to
matching records.Index seek is preferable.However,Index scan is more efficient
when the table is small or a large percentage of records match the predicate.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">21. What are the different Transactional Faults?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Dirty Reads</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Non Repeatable reads</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Phantom Rows</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)Lost Updates</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)Deadlocks"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">22. What is Dirty Reads?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Transaction 2 can read Transaction 1's uncommitted
changes. Most gregarious.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">23. What is Non Repeatable Reads?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Similar to Dirty Reads,But Transaction 2 can read
committed updates of Transaction 1 also.At any point of time,Transaction 2 should
produce the same result set but if reading a row twice gives 2 different
results then its<span style="mso-spacerun: yes;"> </span>a non repeatable read.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">24. What is Phantom Rows?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A update in transaction 1 causes the select in
transaction 2 to return different set of rows.Less</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">25. What is Lost Updates?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When the second user's updates overwrite the first
user's update when they are both trying to update the same table.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">26. What is Deadlocks?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When 2 transactions with multiple tasks compete for the
common task, then its deadlock. Transaction 1 locks data A and needs to lock
data B to complete the transaction. Transaction 2 has locked data B and needs
to lock data A to complete the transaction. Each transaction is stuck waiting
for the other to release its lock, and neither can complete</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">until the other does. Unless an outside force intercedes, or
one of the transactions gives up</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">and quits, this situation could persist until the end of
time.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">27. What are the different Transaction Isolation Levels?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Read Uncommitted, Read committed, Repeatable Read, Serializable,
Snapshot, Read Committed Snapshot</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">28. What is Read Uncommitted?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. no locks,least restrictive,doesn’t prevent any
transactional faults,good for reporting</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">29. What is Read Committed?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. prevents Dirty Reads but doesn’t make the system down
with excessive lock contention.Thats why SQL Server's default</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">30. What is Repeatable Read?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. By preventing dirty reads and non-repeatable reads, the
repeatable read isolation level</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">provides increased transaction isolation without the extreme
lock contention of serializable</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">isolation.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">31. What is Serializable Read?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Prevents every transactional faults,Extreme lock
contention,imp in systems where transactional integrity is more imp than
performance like Banking</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">32. What is Snapshot?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Prevents reader vs writer conflict.Makes a snapshot
copy of the data being updated.When the update is committed, it’s written back over
the original data. So readers continue to read the same snapshot copy when the
writer has already updated the db. But gave rise to writer-writer conflict.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">33. What is Read Committed Snapshot?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. This variation of snapshot isolation behaves the same
as read committed but without the writer versus reader contention.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">34. What is Event Logging?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. SSIS logging is feature that enables the tracing of a
package execution. It can be applied to the package level or on the task level.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1. Right click on the package body</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2. Chose the log provider type(Text File, Windows Log, XML,
SQL Profiler, SQL Server.)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3. Configure it by placing it's connection.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4. Specify the event in the details tab.Package logging has
a loggingmode which accepts three values-enabled,disabled and
UseParentSetting(To use parent's setting of that component to decide whether or
not to log the data)."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">35. What happens when RetainSameConnection Property is set
to true?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. RetainSameConnection Property on OLEDB Connection
manager enables us to handle SQL Server transactions without the use of
MSDTC(Microsoft Distributed Transformation Coordinator.)By using
RetainSameconnection property on the OLEDB Source,we can maintain transactions
over multiple tasks.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">36. What is Package Configuration?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Package Configuration is nothing but exposing the
properties of the package to get updated by the values coming from the File,
Table, Environment variable, Parent package variable or registery key. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">37. Send Mail Task(How to write CC,BCC,From and To)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Message source type can be a variable, Text file or
direct input.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">38. How to abruptly kill a package running on server?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. In write Action of Windows administrators,Kill the
Process running the package,stop the job.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">39. How to know which package is running on server?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. SSIS Package Instances is a performance counter that
gives- Total number of simultaneous SSIS Packages running</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">40. What is FTP task?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Can able to perform any file operations in server.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">41. What is Difference between Lookup and Fuzzy Lookup?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Lookup gives the exact match where as Fuzzy lookup
gives similar matches.For each row in the input lookup will produce only 1
result but Fuzzy lookup will give many.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">42. What is Difference between Control Flow(CF) and Data
Flow(DF)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)A CF is process oriented while DF is data oriented.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)A CF comprises Tasks,Containers and precedence Constraints
while DF comprises Sources,Transformations and Destinations.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)A CF's fundamental unit is Task but a DF's fundamental
unit is component.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)A CF's outcome may be Success,Failure or Completion but
DF's can be anything."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">43. What is Difference between Merge and Union All?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Merge needs Sorted input whereas Union All does not.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Merge give sorted output but union all does not.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Merge can take only 2 datasets but Union All can take more
than 2 datasets.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">44. How to create SubReport?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Sub-Report is a Report item which can be included
inside the report and for each row of the main report the sub report can be
processed. Sub-Report is actually a reference to a different report.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">45. What is Views?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. We can only use select statement inside<span style="mso-spacerun: yes;"> </span>a view.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">•To hide the complexity of the underlying database schema,
or customize the data and schema for a set of users. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">•To control access to rows and columns of data. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">•To aggregate data for performance.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">We can insert,update or delete a view.(if aggregate functions
or joins are not there)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">46. When 1 package is being called from another package and
both are deployed in server,then what should be the child package's path
name?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. HTTP Connection Manager</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">47. Which is the most efficient way of reporting? A
complicated dataset,A Stored Procedure,A dynamic procedure<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Depends on profiler and execution log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">48. How to create a Drill Down Report?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Create any report, create group over the data region.
On the details set the hidden property true and in toggle by any report item
select the group.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">49. How to get error description in SSIS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. In a Script component we need to write the following
code to get the error description:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Imports System</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Imports System.Data</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Imports System.Math</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Imports Microsoft.SqlServer.Dts.Runtime.Wrapper</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Public Class ScriptMain</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Inherits
UserComponent</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Public Overrides
Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>'Use the
incoming error number as a parameter to GetErrorDescription</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;">
</span>Row.ErrorDescription =
ComponentMetaData.GetErrorDescription(Row.ErrorCode)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>End Sub</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">End Class"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">50. Explain the Architecture of SSIS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. SSIS architecture consists of four key parts:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">a) Integration Services service: monitors running
Integration Services packages and manages the storage of packages.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">b) Integration Services object model: includes managed API
for accessing Integration Services tools, command-line utilities, and custom applications.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">c) Integration Services runtime and run-time executables: it
saves the layout of packages, runs packages, and provides support for logging,
breakpoints, configuration, connections, and transactions. The Integration
Services run-time executables are the package, containers, tasks, and event
handlers that Integration Services includes, and custom tasks.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">d) Data flow engine: provides the in-memory buffers that
move data from source to destination. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">51. What is Synchronous Transformations?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Row transformations either manipulate data or create
new fields using the data that is available in that row. Examples of SSIS
components that perform row transformations include Derived Column, Data
Conversion, Multicast, and Lookup. While these components might create new
columns, row transformations do not create any additional records. Because each
output row has a 1:1 relationship with an input row, row transformations are
also known as synchronous transformations. Row transformations have the
advantage of reusing existing buffers and do not require data to be copied to a
new buffer to complete the transformation</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">52. What is Asynchronous Transformations?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Partially blocking transformations are often used to
combine datasets. They tend to have multiple data inputs. As a result, their
output may have the same, greater, or fewer records than the total number of
input records. Since the number of input records will likely not match the
number of output records, these transformations are also called asynchronous
transformations. Examples of partially blocking transformation components
available in SSIS include Merge, Merge Join, and Union All. With partially
blocking transformations, the output of the transformation is copied into a new
buffer and a new thread may be introduced into the data flow. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">53. What is Blocking transformations?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Blocking transformations must read and process all
input records before creating any output records. Of all of the transformation
types, these transformations perform the most work and can have the greatest
impact on available resources. Example components in SSIS include Aggregate and
Sort. Like partially blocking transformations, blocking transformations are
also considered to be asynchronous. Similarly, when a blocking transformation is
encountered in the data flow, a new buffer is created for its output and a new
thread is introduced into the data flow. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">54. What is Fuzzy Grouping?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1) The Fuzzy Grouping transformation performs data
cleaning tasks by identifying rows of data that are likely to be duplicates and
selecting a canonical row of data to use in standardizing the data. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">The transformation produces one output row for each input
row, with the following additional columns:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)_key_in, a column that uniquely identifies each row. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)_key_out, a column that identifies a group of duplicate
rows. The _key_out column has the value of the _key_in column in the canonical
data row. Rows with the same value in _key_out are part of the same group. The
_key_outvalue for a group corresponds to the value of _key_in in the canonical
data row. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)_score, a value between 0 and 1 that indicates the
similarity of the input row to the canonical row.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">We can also specify the value of Similarity Threshold.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">55. How to do Fast load without failure of the batch?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. You can’t do fast load without failure of batch. In
fast load option the batch will fail if a record failed to insert.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">56. How to execute a Procedure in Execute SQL Task?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. EXEC Procedure Name ?,?,? - '?' denotes the parameters.
And the parmeters will be set in the expression.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">57. How to get the connection string dynamically?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. By writing an expression on the connection string
property of the connection manager.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">58. How to run Tasks parallelly?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Each Package has MaxConcurrentExecutables property that
is set to -1 by default,which means the total no of tasks can be executed is
n+2 where n is the no of processors of the system.We can change this number to
an absolute value that indicates absolute no of tasks that can be executed in
parallel.In DF,we can set threads which will execute different execution trees
of the DFT.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">59. Which is the Default container of SSIS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Task Host Container</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">60. How to check the quality of data at run time?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Data Viewer, Data Profiler</span><br />
<span style="font-family: inherit;"></span><br />
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">61. How to remove Sort transformation?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. You can avoid the Sort transformation while using OLEDB
sources. You can use order by clause to sort the input records. Then set the
Issorted property as true and set the sort key positions of the order by
columns. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">62. How to put if else in Data Flow and Control Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Control flow- Precedence constraints</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Data flow-Conditional Split transformation </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">63. How to set the Buffer in Data Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Each DFT has 2 properties-DefaultMaxBufferRows and
DefaultMaxBufferSize which control respectively the number of rows which can be
stored in a single buffer and how many buffers can be
created.DefaultMaxBufferRows has default value 10000 rows and
DefaultMaxBufferSize has default value 10 MB.Any data eg BLOB data if cant be
put in the buffer is spooled to the File System.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">64. How to ignore the failure in Control Flow and Data
Flow?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. <span style="mso-spacerun: yes;"> </span>Control Flow-
Use precedence constraints as on completion</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Data Flow- Redirect row on failure</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">65. How to migrate DTS packages to SSIS packages?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Open<span style="mso-spacerun: yes;"> </span>BIDS.In
BIDS go to the Project tab and click on Migrate DTS 2000 Package.Give the
Source location and destination location and complete the wizard steps.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">66. How you upgrade a package from SSIS 2005 to SSIS
2008r2?<span style="mso-spacerun: yes;"> </span>Ans. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">67. How to create a SSAS Cube and deploy it?(Building a cube
with data source)<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.First create an analysis services project.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.Create a Data Source (Connection made to the server and database
and authentication provided.) by right clicking on the data source of the
project which will start a wizard.(Extension will be .ds)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Create a Data Source View(Add tables from one or more
database and add related tables for the added tables.Can also add filters) by
right clicking on the data source view of the project which will start a
wizard.(Extension will be .dsv)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.Right Click on the Cube and Click on a new cube which will
start a Cube wizardThe Cube Wizard will ask for Select bui.Here we have to
check the measure group tables and check the relevant measures for the measures
group tables and dimension tables.(Extension will be .cube)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.To hide particular measure groups and dimensions to
particular users,create perspectives.We can rename the already created
perspective and for the new perspective we can check and uncheck based on the
requirement.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.In BIDS,we can build and then deploy the cube.After that
we can right click on the particular cube and then browse.In browse window,we
will have drag nad drop row fields and column fields.In Row fields basicallly
we will drag dimension rows and in column fields we will drag fact measures.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">68. How to create a SSAS Cube and deploy it?(Building a cube
without data source)<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.Right Click on Cube.Cube wizard will ask for 'Select
build method-with or without using data source'.Click on ""Build the
cube without using data source"".</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.Then define measures.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Define Dimensions and Dimension Usage and complete the
wizard. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.Now create the datasourceview and create data source in
that.The wizard that pops up this time is called Schema Generation wizard.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.Populate the data source with data so that cube can be
populated.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.Process the Cube and View the Cube."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">69. How to create an SSRS report using SSAS?<span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.In the Data Source,put the Source type as Analysis
Services and put the analysis Server name.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.In the Dataset,click on Query builder.The Query builder
will open the SSAS Query Designer Window.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.Then we can drag and drop fields on the results pane of
the Query designer as per our requirement.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.There are several buttons in the tool bar of the Query
builder that can be used in MDX like Add Calculated Members,Show Empty
Cells,Auto Exec,Show Aggregates.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.The Auto Exec button turns on and off the execution of
queries.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6.The Show Empty Cells works this same as the MDX Non Empty
clause; basically it shows / hides non empty cell values. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">7.In the upper half of the design area,the query designer
contains a filter grid which is useful for filtering the results and serves as
an easy way of creation of parameters.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">8.Clicking OK on the SSAS query builder gives rise to MDX
query in the query string of Dataset.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">9.Now we can make any type of reports using the fields
provided by the dataset."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">70. How to create parameters/Multivalued parameters in SSRS
report using SSAS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1.We can put<span style="mso-spacerun: yes;"> </span>all
values in the filter expression and can check the parameter.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2.By default,in report parameters a report parameter will be
created and a hidden dataset for the parameter will be created.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3.If we right click on the dataset and click on
""Show Hidden Datasets"",then we will get the dataset.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4.But in previewing the report,we will get two All
values-one Select All and another All.One Select All is the property of the
SSRS multivalued Property of the parameter and the second parameter is driven
from the MDX query that SSRS runs to populate the parameter list. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5.We can remove the second one by :-</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>making a change in
the MDX query i.e. making Parameters.AllMembers as parameters.Children or
filtering out the condition that Parameterlevel > 0 .(Because All of MDX
query will have Parameter level 0)</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">71. What is Cube Scheduling?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When we deploy a SSAS Project,the Data Sources,Data
Source Views<span style="mso-spacerun: yes;"> </span>are put in the local
instance of the SQL Server Analysis Server.Whatever changes are made to the
production database or Analysis service will not be reflected in the local
instance of analysis service until we deploy the project again.We have to
process the cube each and everytime.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">We can process the cube manually (using Management Studio).</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)In order to schedule the processing of the cubes at a
particular time,we can make use of Analysis Services Process Task in SSIS and
give the Cube name.Then we can make a job scheduling this Package.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Right click on the cube and click on process.Click on
Script and click on Copy to clipboard and cancel.Then make a new job and in
command,paste the same and schedule the job."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">72. What is Dimensions?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Dimension is a context by which we slice and dice data
in a DW.Types :1)Conformed 2)Junk 3) Role playing</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">73. What is Conformed Dimensions?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Two dimensions are said to be conformed if they are
completely identical or strict mathematical subsets of each other.Conformed
dimensions have same row headers and labels also.Eg:-Time dimension used for
Fact1 and Time dimension used for Fact2</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">74. What is Junk Dimensions?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. After database modelling,if there are some attributes
which are not linked to any of the dimensions or fact and they are of less
importance and they carry some distinct values(mostly flag values or
indicators),then in that case we can go for a dimension which carries all these
attibutes.These dimensions are known as junk dimensions.Benefits :-One
dimension having all the attributes will perform better compared to individual
dimension for each attribute.Disadvantage:-If in future we will think of making
an attribute as a fully fledged dimension,then in that case we have to
restructure the cube.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">75. What is Degenerate Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. When we have columns on the fact table that do not
relate to any of the dimensions but are most required for analysis,then we can
make<span style="mso-spacerun: yes;"> </span>a separate dimension for the
attribute.This dimension is called Degenerate Dimension.For Eg: A transaction
number or a ticket number which is a most requested feature can be stored
separately as distinct values in a degenerate dimension because the fact will
have multiple records for 1 transaction id.So while quering or analysing
Transaction no or Ticket no,we can go by degenerate dimension table.In some of
the degenerate dimensions,we can put another column which is not degenerate and
a running id for the degenerate transaction id.The difference between normal
dimension and a degenerate dimension is that degenerate attribute should not be
available to the end user for analysis in analysis services.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">76. What is Role Playing Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Dimensions are often recycled for multiple applications
within the same database.A Date dimension can be used for
Date_of_Hire,Date_of_Joining etc.So it’s a role playing dimension. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">77. Explain Slowly Changing Dimensions?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Slowly Changing Dimensions are dimensions that have
data that changes slowly rather than changing on<span style="mso-spacerun: yes;"> </span>a time based regular schedule.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Type 0-No action is taken</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Type 1-overwrites old data with new data and therefore
does not maintain history</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Type 2-Maintains history by inserting multiple records for
a natural key with different surrogate keys(a running number against a natural
key of the table) and having version numbers or Start Date-End Date.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)Type 3-Contains a column in the table which represents
Original_state.This column contains the first value of the attribute where as
Current_state contains the present value.This doesnt maintain histories of
values in between the original and current state.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)Type 4-Contains a table which will have the current record
and another history table with a create date column.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6)Type 6-Combines approaches of types 1,2 and3.It maintains
individual records having start date,end date and Flag.The Current record's
Flag is set to Y rest all are set to N's."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">78. What is Factless tables or Bridge Tables?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. If in a fact table there exists many to many
relationships with dimensions with no figures or measures or values then it is
known as Factless fact or bridge tables.This table is needed to bridge the
relationships between dimensions.For Eg suppose we have a product dimensions
which contain product key and product related information and we have an offer
dimension which contain offer key and discount related information,its timing
and pricing.We can make a bridge table of Productoffer which stores the product
which has special offers.If the Fact stores Product,Offer and Sale as
Columns,then we will surely miss the information about products which were
having special offers but not having a sale.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">79. What is Snapshot and transaction fact tables?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A Transaction fact table records events and for each
event certain measurements are recorded or values recorded.So when we record a
sale we create a new row altogether for the information relating to sale.A
snapshot fact table records the state of something at different points of
time.For Example the sales of each product every month.Snapshot Fact table
therefore keeps aggregated information which results in lesser data rows,lesser
cubes,faster cube processing and faster querying.But it has no information on
individual transaction levels.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">80. What is UDM(Unified Dimensional Modelling)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It provides a bridge between the user and the data
sources.A UDM is constructed over one or more physical data sources and then
the user issues queries against the UDM.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">81. What is Two tier architecture of SSAS?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. SSAS uses both server and client components to supply
OLAP and data mining functionality.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Server component is implemented as a Microsoft windows
service.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2) Clients interact using Standard XML."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">82. Difference between Derived measure and Calculated
measure?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1) A derived measure calculates before agggregations
are created and the value is stored in the Cube.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)A calculated measure calculates after aggregations are
created and the value is not stored inside the Cube."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">83. What is Cube?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Cubes are a logical representation of multidimensional
data.It stores large amounts of historical data.It alos shows the point in time
data and it shows the member level data and security is very detailed.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">84. Differences between OLTP and OLAP<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)OLTP contains the source information of any
system.OLAP contains the data from OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)OLTP controls and runs the fundamental business tasks like
insertion,updation etc but OLAP is meant for planning,analysing and decision
support.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)OLTP performs transactions like insert,update,delete
etc.OLAP performs querying and analysis of the aggregated data of OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)OLTP basically uses smaller and less complex queries but
OLAP uses complex queries.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">5)OLTP is normalized with 3N but OLAP is denormalized with
Star Schema or snowflake schema.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">6)OLTP uses relational schema but OLAP uses multidimensional
schema.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">7)Backup of OLTP is very important but in case of OLAP we
can always bring it from OLTP.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">8)Data in OLTP can be seen instantly but in OLAP a batch or
scheduler wil refresh the data."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">85. Star Schema vs Snowflake Schema<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Snowflake Schema:No redundancy,normalized,more complex
queries,more joins,more FK's,good to use for small dw,To be used when dimension
table is small in size</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Star Schema:Redundant data,de normalized,less complex,good
to use for large dw's,To be used when dimension table is very big in size"</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">86. What is Normalization?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Normalization is the mathematical model of evaluating
the relational quality of the data model.The purpose is to reduce update
anomalies.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">87. What is First Normal Form(1 NF)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 1st Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)Every unit of data should be represented by a scalar
value.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)Each and every attribute i.e column should be unique in an
entity.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)Each and every tuple should be unique in an entity.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Consider a case where a table has columns
basecamp,tour1,tour2,tour3.This table violates 1NF because there are so many
attributes holding the same meaning.We can make two tables one having basecamp
id and basecamp and the other table having basecampid and tour to bring it to
1NF."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">88. What is Second Normal Form(2 NF)?</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 2nd Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)The entity should be in 1 NF and</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)There should be no partial dependency on the Primary
Key.Suppose in the basecamp-tour table,we have columns basecampid,tour and
phonenumberofthebasecamp.The PK of the table is a composite primary key having
basecampid and tour columns.But in this case phonenumber is dependent on
basecamp not on tour.So this violates 2NF.We can make two tables basecamp-tour
having basecampid and tour and second table having basecampid and phonenumber.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">89. What is Third Normal Form(3NF)?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 3rd Normal Form states that:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">1)the entity should be in 2nF and</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)There should be no transitive dependency on the primary
Key.Suppose there ia atable basecamp-tour in which we have columns like
Basecamp_id,Tour,Guide and GuideDateofHire.In this case GuideDateofHire is
dependent on Guide which again is dependent on Basecamp_id.Thats why this
violates the 3 NF.To resolve this,we can make another table Guide having Guide
and GuideDateofHire."</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">90. What is Boyce Codd Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It occurs between the third and fourth normal forms.It
handles those kind of entities which have two sets of primary keys.In such case
BCNF states that the entity should be split into two entities one for each
primary key.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"></span><br /></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">91. What is Fourth Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. It reduces problems created by complex composite
primary keys.If there are three attributes in an entity in which two of the
attributes combine to form a composite primary key but without the third attribute
the row is not unique,then in that case the entity violates 3NF.In such case we
should split the table into two separate tables.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">92. What is Fifth Normal Form?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. The 5NF provides the method for designing relationships
that involve 3 or more entities.A three-way or ternary relationship, if
properly designed, is in the fifth normal form.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">93. What is Recovery Models in SQL Server 2008?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Simple,Full,Bulk Logged</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Alter database databasename set recovery simple</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">94. What is Simple Recovery Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. 1)SQL Server stores only minimal information in the
transaction log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">2)The Changes made to the database are written to the data
and to the log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">3)But the log files are not kept permanently.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">4)It should be used on a db which is meant for development
or test where there is a reduced need of frequent database backups.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Backup options for this model are Full .</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">95. What is Full Recovery Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. This allows us to recover everything.It can use fullest
set of backup options.So it can be used to recover the fullest set.Every
insert,update,delete is logged into the transaction log.The committed changes
are deleted from the log once the back up of the log is taken.It allows
point-in-time recovery means it allows us to recover the database to a
particular point in time.Backup options for this model are Full,Differential
and Transaction Log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">96. What is Bulk Logged Model?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. This is same as Full Recovery model but this is used in
cases of bulk operations like create index,select into and bulk insert.All the
bulk operations are written minimally to the transaction log there by improving
performance.Backup options for this model are Full,Differential and Transaction
Log.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">97. What is Backups?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Full,Differential and Transaction</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">98. What is Full Backups?<span style="mso-spacerun: yes;">
</span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A full backup retsores all our data but it will not
restore all the data at a specific point of time.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">99. What is Differential Backup?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A differential back up copies all the data changes
since the last full back up.So these back ups are usually faster and smaller
than Full back ups.A Full backup creates a checkpoint meaning that the
differential back up has to start from that point.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">100. What is Transaction Log Back up?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A transaction log backup will copy all the data changes
since the last Full transaction or previous transaction log back up.they are
fast and small but the demerit is recovery where we will get a transaction log
for each day.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">101. What is MSDTC?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. MSDTC is a Transaction Manager which allows the client
application to include different sources of data within one transaction.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">For example: SSIS includes different data sources data into
one transaction to main the acid property.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">102. What is ACID?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Atomic, Consistent, Isolated and Durable.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">103. What is Report Subscription?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A Subscription is a standing request to deliver a
report at a specific time or to respond to a specific event, and in an
application file format that you specify in the subscription.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Two types- Standard Subscription, Data driven Subscription</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Stanard Subscription- Consists if static values and cann't
be modified during subscription processing.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Datadriven Subscription- get subscription information at
runtime by quering an external data source that provides values used to specify
reciptant, parameter or application format.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">104. What is XML from a select query?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. <Select query> For XML RAW/AUTO/PATH/EXPLICIT;</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml raw</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><row EmpName=""Shakti""
DeptID=""2"" Sal=""3000""/><row
EmpName=""Praveen"" DeptID=""2""
Sal=""4000""/><row EmpName=""Rohit""
DeptID=""1"" Sal=""2000""/><row
EmpName=""Wamsi"" DeptID=""1""
Sal=""1500""/><row EmpName=""Kapil""
DeptID=""2"" Sal=""1300""/><row
EmpName=""XXX"" DeptID=""10""
Sal=""1000""/><row EmpName=""Rahul""
DeptID=""1"" Sal=""1000""/></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml auto</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><emp EmpName=""Shakti""
DeptID=""2"" Sal=""3000""/><emp
EmpName=""Praveen"" DeptID=""2""
Sal=""4000""/><emp
EmpName=""Rohit"" DeptID=""1""
Sal=""2000""/><emp
EmpName=""Wamsi"" DeptID=""1""
Sal=""1500""/><emp
EmpName=""Kapil"" DeptID=""2""
Sal=""1300""/><emp
EmpName=""XXX"" DeptID=""10""
Sal=""1000""/><emp
EmpName=""Rahul"" DeptID=""1""
Sal=""1000""/></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select * from emp for xml path</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><row><EmpName>Shakti</EmpName><DeptID>2</DeptID><Sal>3000</Sal></row><row><EmpName>Praveen</EmpName><DeptID>2</DeptID><Sal>4000</Sal></row><row><EmpName>Rohit</EmpName><DeptID>1</DeptID><Sal>2000</Sal></row><row><EmpName>Wamsi</EmpName><DeptID>1</DeptID><Sal>1500</Sal></row><row><EmpName>Kapil</EmpName><DeptID>2</DeptID><Sal>1300</Sal></row><row><EmpName>XXX</EmpName><DeptID>10</DeptID><Sal>1000</Sal></row><row><EmpName>Rahul</EmpName><DeptID>1</DeptID><Sal>1000</Sal></row></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="mso-spacerun: yes;"><span style="font-family: inherit;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 1 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>NULL as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">union</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 2 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>1 as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>DeptID as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>null as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">union</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">select 3 as Tag,</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>2 as Parent, </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>EmpName as
[Employee!1!EmpName],</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>DeptID as
[DeptID!2!DeptID], </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Sal as [Sal!3!SAL] </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">from emp </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">order by EmpName</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">for xml explicit</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><Employee
EmpName=""Kapil""><DeptID
DeptID=""2""><Sal
SAL=""1300""/></DeptID></Employee><Employee
EmpName=""Praveen""><DeptID
DeptID=""2""><Sal
SAL=""4000""/></DeptID></Employee><Employee
EmpName=""Rahul""><DeptID
DeptID=""1""><Sal
SAL=""1000""/></DeptID></Employee><Employee
EmpName=""Rohit""><DeptID DeptID=""1""><Sal
SAL=""2000""/></DeptID></Employee><Employee
EmpName=""Shakti""><DeptID
DeptID=""2""><Sal SAL=""3000""/></DeptID></Employee><Employee
EmpName=""Wamsi""><DeptID
DeptID=""1""><Sal
SAL=""1500""/></DeptID></Employee><Employee
EmpName=""XXX""><DeptID
DeptID=""10""><Sal
SAL=""1000""/></DeptID></Employee></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">the values in the Tag and Parent meta columns, the
information provided in the column names, and the correct ordering of the rows
produce the XML you want when you use EXPLICIT mode.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">105. What is SET XACT_ABORT { ON | OFF }?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. Specifies whether SQL Server automatically rolls back
the current transaction when a Transact-SQL statement raises a run-time error.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">106. What is Computed Column?<span style="mso-spacerun: yes;"> </span></span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Ans. A computed column is computed from an expression that
can use other columns in the same table. The expression can be a noncomputed
column name, constant, function, and any combination of these connected by one
or more operators. The expression cannot be a subquery. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">For example, in the AdventureWorks2008R2 sample database, the
TotalDue column of the Sales.SalesOrderHeader table has the definition:
TotalDue AS Subtotal + TaxAmt + Freight. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Unless otherwise specified, computed columns are virtual
columns that are not physically stored in the table. Their values are
recalculated every time they are referenced in a query. The Database Engine
uses the PERSISTED keyword in the CREATE TABLE and ALTER TABLE statements to
physically store computed columns in the table. </span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;">Computed columns can be used in select lists, WHERE clauses,
ORDER BY clauses, or any other locations in which regular expressions can be
used, with the following exceptions:</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>Computed columns
used as CHECK, FOREIGN KEY, or NOT NULL constraints must be marked PERSISTED. A
computed column can be used as a key column in an index or as part of any
PRIMARY KEY or UNIQUE constraint if the computed column value is defined by a
deterministic expression and the data type of the result is allowed in index
columns.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>For example, if
the table has integer columns a and b, the computed column a + b can be
indexed, but computed column a + DATEPART(dd, GETDATE()) cannot be indexed
because the value may change in subsequent invocations.</span></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<o:p><span style="font-family: inherit;"> </span></o:p></div>
<span style="font-family: inherit;">
</span><br />
<div class="MsoNormal" style="margin: 0in 0in 10pt;">
<span style="font-family: inherit;"><span style="mso-spacerun: yes;"> </span>A computed column
cannot be the target of an INSERT or UPDATE statement.</span></div>
<span style="font-family: inherit;">
</span></div>
</div>
</div>
Radhajyotsnahttp://www.blogger.com/profile/07593386476304686574noreply@blogger.com2