<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7924929528826389309</atom:id><lastBuildDate>Wed, 07 Oct 2026 13:29:57 +0000</lastBuildDate><category>SSIS</category><category>T-SQL</category><category>SSRS</category><category>SQL Server</category><category>SSAS</category><category>Cube</category><category>SSIS Containers</category><category>Script Task</category><category>SSRS Expressions</category><category>Foreach Loop Container</category><category>Puzzle</category><category>SQL Server 2012</category><category>SSRS Grouping</category><category>Conditional Formatting</category><category>Sequence Container</category><category>Analysis Services Execute DDL Task</category><category>Date Dimension</category><category>Report Parameters</category><category>Analysis Services  Processing Task</category><category>Degenerate Dimension</category><category>For Loop Container</category><category>Import Export Wizard</category><category>KPI</category><category>Package Configurations</category><category>SSIS Logging</category><category>Send Mail Task</category><category>SharePoint List Source</category><category>Shared Data Source</category><category>Table Partition</category><category>Time Dimension</category><title>Tips and Tricks for SQL-BI</title><description></description><link>http://sql-bi-dev.blogspot.com/</link><managingEditor>noreply@blogger.com (Hari Sharma)</managingEditor><generator>Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-934280913406917278</guid><pubDate>Sat, 10 Nov 2012 08:00:00 +0000</pubDate><atom:updated>2012-11-10T00:00:05.857-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Conditional Formatting</category><category domain="http://www.blogger.com/atom/ns#">SSRS</category><category domain="http://www.blogger.com/atom/ns#">SSRS Expressions</category><category domain="http://www.blogger.com/atom/ns#">SSRS Grouping</category><title>Dynamic Color Coding in SSRS Charts</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this article, I will explain &lt;strong&gt;how to change the color of a chart dynamically&lt;/strong&gt;. In other words, how to provide custom &lt;strong&gt;color palette&lt;/strong&gt; feature at run time.&lt;br /&gt;
&lt;br /&gt;
Lets start off with an example including step by step operations.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step1&lt;/strong&gt;. Open or create new &lt;strong&gt;Report Server Project&lt;/strong&gt;. I am creating a new Report Server Project using SQL Server 2012&amp;nbsp;and saved it&amp;nbsp;with&amp;nbsp;&lt;strong&gt;LearnSSRS2012&lt;/strong&gt;&amp;nbsp;name. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step2&lt;/strong&gt;. Add new &lt;strong&gt;Shared Data Source&lt;/strong&gt; by right click on &quot;Shared Data Sources&quot; folder.&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;left&quot; class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCEUwBX78yB3p1rBdNn1Y9Aqbv7cVdwiv1jZ7Vp_IfHo4u_63VOkOFn2gQBvw6rfmkrau9JSzqNPEgHdN_yKKkUpEOmyx4T9W6U2kf63EU8I5Vf8qM8BsZH0AOEz1EBc94fHw8WnPhju3u/s1600/DynamicChartCode0.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCEUwBX78yB3p1rBdNn1Y9Aqbv7cVdwiv1jZ7Vp_IfHo4u_63VOkOFn2gQBvw6rfmkrau9JSzqNPEgHdN_yKKkUpEOmyx4T9W6U2kf63EU8I5Vf8qM8BsZH0AOEz1EBc94fHw8WnPhju3u/s1600/DynamicChartCode0.png&quot; /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp;Now give any name to Share Data Source (Local, in my case) and click on Edit button to define Server Name and Database Name. In this example, I will use static data sources so I am using &quot;.&quot; (you can also use &quot;(local)&quot;) as ServerName. I am not defining any Database name so I will keep it blank (default will be msater). You can define any database, if you want. Now click on OK.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi23tiD0zxwHeHbFGkz4dTgxC6-HOz3rtxMqrt_PVQjfgYoGxx1UjTDHCZ1jlk-7wLllDhAzTvUUNY3a6QJDsP1MfIND7Y86sDa1S0V7xBQzY5kSbgPGpod-X_GLj519MTPAbHIOAJQF8Zx/s1600/DynamicChartCode0.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;293&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi23tiD0zxwHeHbFGkz4dTgxC6-HOz3rtxMqrt_PVQjfgYoGxx1UjTDHCZ1jlk-7wLllDhAzTvUUNY3a6QJDsP1MfIND7Y86sDa1S0V7xBQzY5kSbgPGpod-X_GLj519MTPAbHIOAJQF8Zx/s400/DynamicChartCode0.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Step3&lt;/strong&gt;. Now create a new report by clicking on Reports --&amp;gt; Add --&amp;gt; New Item --&amp;gt; Report --&amp;gt; Add. I don&#39;t like default report name like Report1, Report2, Report3 so I have renamed it to &lt;strong&gt;ChartColorCode.rdl&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step4&lt;/strong&gt;. Create Data Source for ChartColorCode report.&amp;nbsp;To create a new Data Source, right click on &quot;Data Sources&quot; followed by &quot;Add Data Sources&quot; under Report Data as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDZvdrfTcz8JVSbBQwnN_Jh4S3KRCDOis3h2FyrA-kZtf7f35ZeXeu4dATZIc-tdHY5bgdMfdvcb-xwsqfYxNTIoBIN9l3S1rQCkTXY3OzE3v9bSWKKfCap8J8Mgz6afv00xVQpXgxXNLn/s1600/DynamicChartCode02.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDZvdrfTcz8JVSbBQwnN_Jh4S3KRCDOis3h2FyrA-kZtf7f35ZeXeu4dATZIc-tdHY5bgdMfdvcb-xwsqfYxNTIoBIN9l3S1rQCkTXY3OzE3v9bSWKKfCap8J8Mgz6afv00xVQpXgxXNLn/s1600/DynamicChartCode02.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We will use Shared Data Source we created above. So click on &quot;Use shared data source reference&quot; and select &lt;strong&gt;Local&lt;/strong&gt; data source created at step 2. Give any name to this report level data source. I will assign &quot;Local&quot; again. Click OK to proceed.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTYE_uDTPhFqI6K6_NsEKBH9QcOz-z2lYSMZ3k9ILAOuGC-8RfPaxIoOsgVJOMKyRls6kYP8MrpSBmNmHn8j-iiv3Uqh1wdd2cYeHOBJryjrCH-AozNOHkE1ge6IM3pXmENFyZc_vm5n8_/s1600/DynamicChartCode03.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;293&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTYE_uDTPhFqI6K6_NsEKBH9QcOz-z2lYSMZ3k9ILAOuGC-8RfPaxIoOsgVJOMKyRls6kYP8MrpSBmNmHn8j-iiv3Uqh1wdd2cYeHOBJryjrCH-AozNOHkE1ge6IM3pXmENFyZc_vm5n8_/s400/DynamicChartCode03.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Step5&lt;/strong&gt;. Now lets create couple of datasets. To create a new dataset, right click on &quot;Datastes&quot; followed by &quot;Add Datastes&quot; under Report Data as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI7_GBWhgwxfs6h5YIiQ6EeSiF2LmAoYTg4ZTpTKafrCzfMGpI5UcvFHO1wxr8pKCBcoB_rOTvRuJHgi0QbHWIIknvW8sznrZn8ta3sTRsmW6p35ug7yq8_-xuXe0v8YWsl0PGeaf7Q1ID/s1600/DynamicChartCode02.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjI7_GBWhgwxfs6h5YIiQ6EeSiF2LmAoYTg4ZTpTKafrCzfMGpI5UcvFHO1wxr8pKCBcoB_rOTvRuJHgi0QbHWIIknvW8sznrZn8ta3sTRsmW6p35ug7yq8_-xuXe0v8YWsl0PGeaf7Q1ID/s1600/DynamicChartCode02.png&quot; /&gt;&lt;br /&gt;
 &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will use two data sources in this example, one for &lt;em&gt;&lt;strong&gt;Color Palette&lt;/strong&gt;&lt;/em&gt; and another for &lt;em&gt;&lt;strong&gt;Chart&lt;/strong&gt;&lt;/em&gt;.&lt;br /&gt;
&lt;br /&gt;
To create new Dataset for ColorPalette, Right click on DataSets --&amp;gt; Add Dataset... and type &quot;ColorPalette&quot; in Name textbox. Select &quot;Use a dataset embedded in my report&quot; option and select Local as Data Source.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwQQ7L414GFTd7xvWeYl4cjQl3HMsij0k9KJ0p9TFQnfG4wWsxShjIDqr8M1MeoHMfB0tTaeeoq9_8Qz9_pCzurK8mX27C4YqCl68KpXARHUfwwKoYc_StTcfNmUH_8nfOm266ZaahnygR/s1600/DynamicChartCode04.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwQQ7L414GFTd7xvWeYl4cjQl3HMsij0k9KJ0p9TFQnfG4wWsxShjIDqr8M1MeoHMfB0tTaeeoq9_8Qz9_pCzurK8mX27C4YqCl68KpXARHUfwwKoYc_StTcfNmUH_8nfOm266ZaahnygR/s320/DynamicChartCode04.png&quot; width=&quot;313&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Select &lt;u&gt;T&lt;/u&gt;ext option in &quot;Query Type&quot; and type following query in Query window:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Red&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;DarkOrange&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Green&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Blue&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Olive&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;SeaGreen&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Brown&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Gray&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Tomato&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;ColorName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
Click OK to proceed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create one more dataset using following query and name it Chart.ds:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 2010 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;[Year]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 12000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 2011 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;[Year]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 15000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 2012 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;[Year]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 13000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step6&lt;/strong&gt;. Drag and drop &quot;3D Cylinder&quot;&amp;nbsp; bar chart from toolbox. Drag and drop Amount field from Chart.ds to value field (Y axis) and Year field to Category Groups as shown below.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieiWOSnsxgD9JIAiobR6zABFNsFzkqWSd_e9lpkVhipQN2GdJQxJWlybdAcJthq7z_p2L5SiJnnoehizoEZykBZVDX-DSNKJZ5a54N-ROw6dfl2WJkKKaPyQB7soZk6_KpfZVKf7q9NGGV/s1600/DynamicChartCode05.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;243&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieiWOSnsxgD9JIAiobR6zABFNsFzkqWSd_e9lpkVhipQN2GdJQxJWlybdAcJthq7z_p2L5SiJnnoehizoEZykBZVDX-DSNKJZ5a54N-ROw6dfl2WJkKKaPyQB7soZk6_KpfZVKf7q9NGGV/s640/DynamicChartCode05.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;To make the chart more meaningful and dainty, do following formatting:&lt;/u&gt;&lt;br /&gt;
1. Replace Chart Title with &quot;Year&amp;nbsp;vs Amount&quot;.&lt;br /&gt;
2. Replace Y Axis Title with Amount.&lt;br /&gt;
3. Repalce X Axis Title with Year.&lt;br /&gt;
4. Remove the Chart Legend.&lt;br /&gt;
5. Change the font size and color as you wish.&lt;br /&gt;
6. Right click on the bar and select &quot;Show Data Labels&quot;. Select Times New Roman in data labels font because numbers are better visible in this font.&lt;br /&gt;
&lt;br /&gt;
After incorporating all the above changes, click on Preview tab to view the report. My report looks like one shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYoGGa9BcyyZXapuaM3k8czXaeaTe9WXSW7kpoRJH3QYbEM5OHYR4Ijmx8jw7pFIEpn2h3DnDK-u3axqnzJUaknW5qCqpwfMoghVMGTu5zwOR07S-L1MmvYNQ0ABz3gNuxxSn8Z-zh72aG/s1600/DynamicChartCode06.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;215&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYoGGa9BcyyZXapuaM3k8czXaeaTe9WXSW7kpoRJH3QYbEM5OHYR4Ijmx8jw7pFIEpn2h3DnDK-u3axqnzJUaknW5qCqpwfMoghVMGTu5zwOR07S-L1MmvYNQ0ABz3gNuxxSn8Z-zh72aG/s400/DynamicChartCode06.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Step7&lt;/strong&gt;. Now I will explain how to change the chart color at run-time.&lt;br /&gt;
First of all, I will create a report parameter for dynamic color. Click on &lt;strong&gt;Parameters&lt;/strong&gt; folders in Report Data and then click on &lt;strong&gt;Add Parameter&lt;/strong&gt;...&amp;nbsp;Define pColor as report parameter Name and Color as Prompt. Select parameter visibility &lt;strong&gt;Hidden&lt;/strong&gt;. You can keep it as Visible if you wish to do so.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCG6aTlM3Z7V4QelVuMXx5MvjXkLZ8chmW7a5hcwwjru9t4Yfi5ZV3ULKufWtobX2g6JG-Th8r1dcDoxxQFw2Qvo3EVYX66ZuXJWgOBm7lTsBaur_ooNCAXEOsCxSsQ-EPdTWOrT-hQ2TY/s1600/DynamicChartCode11.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCG6aTlM3Z7V4QelVuMXx5MvjXkLZ8chmW7a5hcwwjru9t4Yfi5ZV3ULKufWtobX2g6JG-Th8r1dcDoxxQFw2Qvo3EVYX66ZuXJWgOBm7lTsBaur_ooNCAXEOsCxSsQ-EPdTWOrT-hQ2TY/s400/DynamicChartCode11.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on &lt;strong&gt;Available Values&lt;/strong&gt; under Report Parameter Properties window. Select &quot;Get values from a query&quot; option under &quot;Select from one of the following options&quot;. Select &lt;strong&gt;ColorPalette&lt;/strong&gt;&amp;nbsp;in Dataset box, &lt;strong&gt;ColorName&lt;/strong&gt; in &quot;&lt;u&gt;V&lt;/u&gt;alue field&quot;, and &lt;strong&gt;ColorName&lt;/strong&gt; in &quot;&lt;u&gt;L&lt;/u&gt;abel field&quot;.&lt;br /&gt;
&lt;br /&gt;
Click on&amp;nbsp;&lt;strong&gt;Default Values&lt;/strong&gt;&amp;nbsp;under Report Parameter Properties window. Select &quot;Get values from a query&quot; option under &quot;Select from one of the following options&quot;. Select &lt;strong&gt;ColorPalette&lt;/strong&gt; in Dataset box, and &lt;strong&gt;ColorName&lt;/strong&gt; in &quot;&lt;u&gt;V&lt;/u&gt;alue field&quot;. Click OK to proceed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step8&lt;/strong&gt;. Drag and drop &lt;strong&gt;Table&lt;/strong&gt; control from toolbox.&lt;br /&gt;
&lt;u&gt;Do set following properties for table control.&lt;/u&gt;&lt;br /&gt;
a) Table control will have three default columns. Delete one column.&lt;br /&gt;
b) Merge Table Header and write &quot;Color Palette&quot; in the textbox.&lt;br /&gt;
c) Write following expression in the second column of Table Details.&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;=IIF(Parameters!pColor.Value=Fields!ColorName.Value,&lt;/span&gt;
&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&quot;◄&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: #a31515; font-family: Consolas;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;and write following expression in background property of same text box: &lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas;&quot;&gt;=Fields!ColorName.Value&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
d) Select Table Details and then right click --&amp;gt; select &quot;Row Group&quot; --&amp;gt; select &quot;Group properties&quot;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt4jTwxC2Z0W1cAXTaPvS5WUIx9gZD700utIs3q74Mlo21avH_ko3n6f1ZDpU2okP914BNjZ8sieRj9eju4MQeSSig82K2LIALMzii6VX6r2XF7zNomp7n74QeX2wPMX9RGedWsPTbMzzC/s1600/DynamicChartCode07.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt4jTwxC2Z0W1cAXTaPvS5WUIx9gZD700utIs3q74Mlo21avH_ko3n6f1ZDpU2okP914BNjZ8sieRj9eju4MQeSSig82K2LIALMzii6VX6r2XF7zNomp7n74QeX2wPMX9RGedWsPTbMzzC/s400/DynamicChartCode07.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
e) In &quot;Group Properties&quot; window, click on expression button under &quot;Group on&quot; box and write following expression&amp;nbsp;&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas;&quot;&gt;=Fields!ColorName.Value&lt;/span&gt;.&lt;br /&gt;
&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKy3MFww-t9COoKvY7w9FiNXWpQbLZWwg5mTo7ZtoigC3PvmD3pmZ2NeDOm4zlcU6AP7J7ncky9VXAcWrMkUcDmapVJ8YMPWEWhnZNm7OIvL32a7Yh4UGGU7yTOoB4x9GBB99ayVNKp-LD/s1600/DynamicChartCode08.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;335&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKy3MFww-t9COoKvY7w9FiNXWpQbLZWwg5mTo7ZtoigC3PvmD3pmZ2NeDOm4zlcU6AP7J7ncky9VXAcWrMkUcDmapVJ8YMPWEWhnZNm7OIvL32a7Yh4UGGU7yTOoB4x9GBB99ayVNKp-LD/s400/DynamicChartCode08.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
f) Select first text box of Table Details and then right click to select &quot;Test Box Properties&quot; as highlighted below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd2adg5LIMvYbpv8L5YAZtcgjcAZtLOX41ESCa-sl3mXVdeYY6B0mqFU-Rt3FnTv94PntTB3S2Y-N0Q5EBtUoG07yDdhAQWkWuQ9rhX4SiWTSsdexTg-eZhL52GEtGUA7ZfjqrfATOCXO1/s1600/DynamicChartCode09.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd2adg5LIMvYbpv8L5YAZtcgjcAZtLOX41ESCa-sl3mXVdeYY6B0mqFU-Rt3FnTv94PntTB3S2Y-N0Q5EBtUoG07yDdhAQWkWuQ9rhX4SiWTSsdexTg-eZhL52GEtGUA7ZfjqrfATOCXO1/s1600/DynamicChartCode09.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
g) in &quot;Text Box Properties&quot; dialogue box, click on &lt;strong&gt;Action&lt;/strong&gt; and select &quot;Go to report&quot; under &quot;Enable as an action&quot; and&amp;nbsp;&quot;ChartColorCode&quot; in &quot;Specify a report&quot; box. Also select report parameter &lt;strong&gt;pColor&lt;/strong&gt; in Name and &lt;strong&gt;[ColorName]&lt;/strong&gt; in Value as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaNiX6PoM6X3rk5FxfqpLep-MvzWXHdsBQc8EOlrhPxucPIH4CIlZF59PkGylXzM7DaQt1_sxfFyeFcWrfglVfWe8pibWVMvq3lEx3admWTxa_qNOstJMnOJ5f7kFjVf5fNQqjW7yEcp4K/s1600/DynamicChartCode10.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;291&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaNiX6PoM6X3rk5FxfqpLep-MvzWXHdsBQc8EOlrhPxucPIH4CIlZF59PkGylXzM7DaQt1_sxfFyeFcWrfglVfWe8pibWVMvq3lEx3admWTxa_qNOstJMnOJ5f7kFjVf5fNQqjW7yEcp4K/s320/DynamicChartCode10.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;Step9&lt;/strong&gt;. Now we are at the final step where we need to change the properties of bar chart to change the color at run time. Right click on bar chart and select &quot;Series Properties&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjztSapeCNw_6BMqN0Z-aQ0nuMfKDeYxcGss316RCFMH_LXowDJ3Gd9TUCcm5D1sd-kcwxsRa8iROTJH6twMwKv7LaJbee1Gbdva87Cmy9so3IG2kESylofLpSBBbwyQwvguGoMVvXKjwK3/s1600/DynamicChartCode12.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;167&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjztSapeCNw_6BMqN0Z-aQ0nuMfKDeYxcGss316RCFMH_LXowDJ3Gd9TUCcm5D1sd-kcwxsRa8iROTJH6twMwKv7LaJbee1Gbdva87Cmy9so3IG2kESylofLpSBBbwyQwvguGoMVvXKjwK3/s320/DynamicChartCode12.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In &quot;Series Properties&quot; window, click on &lt;strong&gt;Fill&lt;/strong&gt;. and then click on&amp;nbsp;&lt;strong&gt;expression&lt;/strong&gt; button to open Expression window.&amp;nbsp;Double click on pColor under parameter or write following expression&amp;nbsp;&amp;nbsp;manually as shown below:&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: Consolas;&quot;&gt;=Parameters!pColor.Value&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAwBeHB_lgEbkVznvaDuaDB9mHyREtVVdt_X_ZTwwnIgsl6a19eXCuwRuFRe8_mcdfeu6wUIOCERACvz8Etvce4_0yX7TS2ZaHR1yC2ySzz5Izt6ojXXd3A2K0FUkeiajU5h56B8twIdIq/s1600/DynamicChartCode13.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;227&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAwBeHB_lgEbkVznvaDuaDB9mHyREtVVdt_X_ZTwwnIgsl6a19eXCuwRuFRe8_mcdfeu6wUIOCERACvz8Etvce4_0yX7TS2ZaHR1yC2ySzz5Izt6ojXXd3A2K0FUkeiajU5h56B8twIdIq/s320/DynamicChartCode13.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step10&lt;/strong&gt;. Its time to run the report and see the results.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;First Preview&lt;/strong&gt;:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj99JgmTVpRyOvrAHANdgG7iQzRy6jwiGUIiKcy1Dt6lCrH1fLQV-SyEhhdK7WhWZlHzY7254A4UPdp6pC2rUNw01qWu16Z6-I5YPwMKtI9JOqerRSg9clvttmnrDjDyWRjn1uT6UaWFvE0/s1600/DynamicChartCode14.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;186&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj99JgmTVpRyOvrAHANdgG7iQzRy6jwiGUIiKcy1Dt6lCrH1fLQV-SyEhhdK7WhWZlHzY7254A4UPdp6pC2rUNw01qWu16Z6-I5YPwMKtI9JOqerRSg9clvttmnrDjDyWRjn1uT6UaWFvE0/s400/DynamicChartCode14.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Second Preview&lt;/strong&gt;: Following report will be displayed once we click on &lt;strong&gt;Red&lt;/strong&gt; color under:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8ErPA3ccxsaUT_rWlbvEn-Gxc8o9J2A316jrKn13sytv4ALvVWUIaT8Si1bWRGA8bopEoj0sr2Sw6BOD9S1LijdksfYT5UY58d6SbShUbNymNycElHF7VLlfZ7SXinRRdMNDk2Q88wVI6/s1600/DynamicChartCode15.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;187&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8ErPA3ccxsaUT_rWlbvEn-Gxc8o9J2A316jrKn13sytv4ALvVWUIaT8Si1bWRGA8bopEoj0sr2Sw6BOD9S1LijdksfYT5UY58d6SbShUbNymNycElHF7VLlfZ7SXinRRdMNDk2Q88wVI6/s400/DynamicChartCode15.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Third Preview&lt;/strong&gt;: Following report will be displayed once we click on&amp;nbsp;&lt;strong&gt;DarkOrange&lt;/strong&gt; color under:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGWcrPVZGf9ufvo4aZ5CWkO01DHEqt_VBcnww0tzgivzXd8mgazRY9IJEvLE9dtzZ0TJ1z0VamLfB_C7OI4pspWIF8LHssaNSyNSnBx-IDgzuZMbBOR7K8Js79pVdHHE1XUcP7d0IOhxnN/s1600/DynamicChartCode16.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;187&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGWcrPVZGf9ufvo4aZ5CWkO01DHEqt_VBcnww0tzgivzXd8mgazRY9IJEvLE9dtzZ0TJ1z0VamLfB_C7OI4pspWIF8LHssaNSyNSnBx-IDgzuZMbBOR7K8Js79pVdHHE1XUcP7d0IOhxnN/s400/DynamicChartCode16.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I hope you like this article!&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/11/dynamic-color-coding-in-ssrs-charts.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCEUwBX78yB3p1rBdNn1Y9Aqbv7cVdwiv1jZ7Vp_IfHo4u_63VOkOFn2gQBvw6rfmkrau9JSzqNPEgHdN_yKKkUpEOmyx4T9W6U2kf63EU8I5Vf8qM8BsZH0AOEz1EBc94fHw8WnPhju3u/s72-c/DynamicChartCode0.png" height="72" width="72"/><thr:total>21</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-1046850272789726466</guid><pubDate>Sun, 28 Oct 2012 05:00:00 +0000</pubDate><atom:updated>2012-10-27T22:50:58.722-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><category domain="http://www.blogger.com/atom/ns#">SSIS Logging</category><title>SSIS Logging</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this article I&#39;m writting about &lt;strong&gt;Logging&lt;/strong&gt; features in SQL Server Integration Services (SSIS).&lt;br /&gt;
&lt;br /&gt;
I&#39;hv been&amp;nbsp;using SSIS&amp;nbsp;since last&amp;nbsp;6-7 years and&amp;nbsp;I have had&amp;nbsp;to implement &lt;em&gt;Logging Mechanism&lt;/em&gt; in almost&amp;nbsp;all the&amp;nbsp;projects to track/debug the execution of each and every task/event used in the package. Some of you may say its pretty easy to implement -&amp;nbsp;still&amp;nbsp;I guess we need to take care of logging because some of the things are not so easy.&lt;br /&gt;
&lt;br /&gt;
Integration Services includes logging features that write log entries whenever&amp;nbsp;run-time events occur but the good thing is that it can also write &lt;strong&gt;custom messages&lt;/strong&gt;. Also SSIS supports a diverse set of log providers that can write log entries to: Text files, SQL Server Profiler, SQL Server, Windows Event Log, or XML files.&lt;br /&gt;
&lt;br /&gt;
My favourite log is SQL Sevrer because using sql table I can write my own queries to find logging info&amp;nbsp;related to specific task/event or any failure easily.&lt;br /&gt;
&lt;br /&gt;
Basically SSIS logs are associated with packages and are configured at the package level. The task(s)/container(s) in a package can be enabled for logging even if the package itself is not&amp;nbsp;e.g enable logging on an Execute SQL task without enabling logging on the parent package. Also package/container/task can write to multiple logs. You can enable logging on the package only,&amp;nbsp;however you can choose to enable logging on any individual task/container.&lt;br /&gt;
&lt;br /&gt;
You can select a level of logging as per your requirement by specifying the events to log and the information to log for each event, however&amp;nbsp;some events provide more useful information than others.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll explain Logging&amp;nbsp;using SQL Server 2012. &lt;br /&gt;
&lt;em&gt;Note: SSIS 2005 uses table&amp;nbsp;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sysDtsLog90&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;for logging and SSIS 2008&amp;nbsp;&amp;amp; SSIS 2012 use &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;strong&gt;sysSSISLog&lt;/strong&gt; table &lt;/span&gt;for logging.&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Below is the&amp;nbsp;description of&amp;nbsp;each element in the log schema:&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;Element&lt;/span&gt;&lt;/th&gt;&lt;th&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;Description&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Computer&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The name of the computer on which the log event occurred.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Operator&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The identity of the user who&amp;nbsp;executed the package.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Source&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The name of the container or task in which the log event occurred.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;SourceID&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The unique identifier of the package; &lt;br /&gt;
the For Loop, Foreach Loop, or Sequence container; &lt;br /&gt;
or the task in which the log event occurred.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;ExecutionID&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The GUID of the package execution instance.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;StartTime&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The time at which the container or task starts to run.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;EndTime&lt;/span&gt;&lt;/td&gt;&lt;td&gt;The time at which the container or task stops running.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;DataCode&lt;/span&gt;&lt;/td&gt;&lt;td&gt;An integer value from the DTSExecResult enumeration &lt;br /&gt;
that indicates the result of running task:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;0 - Success&lt;/li&gt;
&lt;li&gt;1 - Failure&lt;/li&gt;
&lt;li&gt;2 - Completed&lt;/li&gt;
&lt;li&gt;3 - Canceled&lt;/li&gt;
&lt;/ul&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;DataBytes&lt;/span&gt;&lt;/td&gt;&lt;td&gt;A byte array specific to the log entry. &lt;br /&gt;
The meaning of this field varies by log entry.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;span style=&quot;color: #660000;&quot;&gt;Message&lt;/span&gt;&lt;/td&gt;&lt;td&gt;A message associated with the log entry.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
The following table describes the predefined events that can be enabled to write log entries when run-time events occur:&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Events&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnError&lt;/td&gt;&lt;td&gt;Writes a log entry when an error occurs.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnExecStatusChanged&lt;/td&gt;&lt;td&gt;Writes a log entry when the execution status of the executable changes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnInformation&lt;/td&gt;&lt;td&gt;Writes a log entry during the validation and execution of an executable to report information.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnPostExecute&lt;/td&gt;&lt;td&gt;Writes a log entry immediately after the executable has finished running.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnPostValidate&lt;/td&gt;&lt;td&gt;Writes a log entry when the validation of the executable finishes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnPreExecute&lt;/td&gt;&lt;td&gt;Writes a log entry immediately before the executable runs.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnPreValidate&lt;/td&gt;&lt;td&gt;Writes a log entry when the validation of the executable starts.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnProgress&lt;/td&gt;&lt;td&gt;Writes a log entry when measurable progress is made by the executable.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnQueryCancel&lt;/td&gt;&lt;td&gt;Writes a log entry at any juncture in the task processing where it is feasible to cancel execution.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnTaskFailed&lt;/td&gt;&lt;td&gt;Writes a log entry when a task fails.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnVariableValueChanged&lt;/td&gt;&lt;td&gt;Writes a log entry when the value of a variable changes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OnWarning&lt;/td&gt;&lt;td&gt;Writes a log entry when a warning occurs.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;PipelineComponentTime&lt;/td&gt;&lt;td&gt;For each data flow component, writes a log entry for each phase of validation and execution. The log entry specifies the processing time for each phase.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Diagnostic&lt;/td&gt;&lt;td&gt;Writes a log entry that provides diagnostic information e.g. you can log a message before and after every call to an external data provider.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Implementing Logging in SSIS 2012&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
To implement the SSIS logging, follow these steps:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step1.&lt;/strong&gt; Create a &lt;em&gt;Connection Manager &lt;/em&gt;for logging database. Right click on Connection Managers area and click on New &lt;strong&gt;OLE DB Connections...&lt;/strong&gt; as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzz_yt0Vqqfzpy2hI65Ii80F0uWfzOAsgGyHRCYGPpHfGukVnjBggiCLXM0W_6zF20kgqM3E7Q69p-FacfCfVj-zdyIikfvwqvhwzC5hy9OmA5zZj3YfRAEh4iWeICtMoY9olWBFHS1AW6/s1600/Logging01.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzz_yt0Vqqfzpy2hI65Ii80F0uWfzOAsgGyHRCYGPpHfGukVnjBggiCLXM0W_6zF20kgqM3E7Q69p-FacfCfVj-zdyIikfvwqvhwzC5hy9OmA5zZj3YfRAEh4iWeICtMoY9olWBFHS1AW6/s320/Logging01.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;strong&gt;Step2.&lt;/strong&gt; In the &quot;Configure OLE DB Connection Manager&quot; click on Create button. Now select &lt;strong&gt;Server Name&lt;/strong&gt; and database name from &lt;strong&gt;Connect a database&lt;/strong&gt;. I am using &lt;strong&gt;(Local)&lt;/strong&gt; server and &lt;strong&gt;Test&lt;/strong&gt; database. Click on Test Connection button to verify the connection.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-5oveAJ1z5bvoc3_uuhKdzCLdP7I3OPqw6zdX_BWcx6hRAr60ekBVVxZpfEfnetrqzV6AHynfBrOBUMyXn355oP_jGwp31-mLqb4QDUh7_eJI8e5VQL0weZatr_ibN3hKIBdir3nIzv_a/s1600/Logging02.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-5oveAJ1z5bvoc3_uuhKdzCLdP7I3OPqw6zdX_BWcx6hRAr60ekBVVxZpfEfnetrqzV6AHynfBrOBUMyXn355oP_jGwp31-mLqb4QDUh7_eJI8e5VQL0weZatr_ibN3hKIBdir3nIzv_a/s320/Logging02.PNG&quot; width=&quot;313&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally click on OK button to save the connection manager. This will create a new connection manage with ServerName.DatabaseName name. In my example, it is &lt;strong&gt;(local).Test&lt;/strong&gt;. You can rename it to appropriate and meaningful name. For instance &lt;strong&gt;cmLogging&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step3.&lt;/strong&gt; Right click anywhere on the package surface area in the Control Flow to open &lt;strong&gt;Configure SSIS Log: Package&lt;/strong&gt; wizard.&amp;nbsp; Check the Package folder checkbox (left side) to enable the logging.&amp;nbsp;Under the &quot;Providers and Log&quot; tab, select &quot;SSIS log provider for SQL Server&quot; in &lt;strong&gt;Provider type&lt;/strong&gt; and click on &lt;strong&gt;Add&lt;/strong&gt; button t add this logging for the package. Finally, click on &lt;strong&gt;Configuration&lt;/strong&gt; to select the logging connection manager. Select &lt;strong&gt;cmLogging&lt;/strong&gt; as connection manager.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EM9jHddHI6BVzDtgkTQQryz8dv1yt8KBra7_35AOBWeR4YHZHWuwsiwO2uuiriAYPKVyXA3aPpWC1jPV_47F6JlF-vkoxyHwgx_E8JUJENw7UH5Ylu_kIedKFMRC-P4FNkiIDkNIJw5l/s1600/Logging04.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;257&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4EM9jHddHI6BVzDtgkTQQryz8dv1yt8KBra7_35AOBWeR4YHZHWuwsiwO2uuiriAYPKVyXA3aPpWC1jPV_47F6JlF-vkoxyHwgx_E8JUJENw7UH5Ylu_kIedKFMRC-P4FNkiIDkNIJw5l/s320/Logging04.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;strong&gt;Step4.&lt;/strong&gt;&amp;nbsp;Select logging events.&lt;br /&gt;
To prevent log files from using large amounts of disk space, which could degrade performance, you can limit logging by selecting specific events and information items to log. For example, you can configure a log to capture only the date and the computer name along with error message.&amp;nbsp;It is not a good idea to log all the events. Under &quot;Details&quot; tab, select required events for logging:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUs-MSqfKYXfbLRs_DuarvooF0rhSbNNmYqXrUytIHwH9G6KaDw1zST6MvCwzJW28976WgsO7CYEnkLKaxxHyGwHDbUsH5_Kf9cYJe6x7WJZ659b0Er5TF78eYHKHZ0-raE4R-aOh_Ivyu/s1600/Logging05.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;237&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUs-MSqfKYXfbLRs_DuarvooF0rhSbNNmYqXrUytIHwH9G6KaDw1zST6MvCwzJW28976WgsO7CYEnkLKaxxHyGwHDbUsH5_Kf9cYJe6x7WJZ659b0Er5TF78eYHKHZ0-raE4R-aOh_Ivyu/s320/Logging05.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step5.&lt;/strong&gt; Click on Advance button&amp;nbsp;to set advance properties of the logging events.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmlyQySNo2FoRUzt26zWdukEo6n9G4FJhFQJNQufyUkz3HVLxADO5TjVccmmVLZJfsHH0mWtL9LHsTsOahnMVfDxRnxEtFgoQ326wthjRISdDNTnV8tX87MLEs4vGFxXaKo96boeR5uoal/s1600/Logging06.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;176&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmlyQySNo2FoRUzt26zWdukEo6n9G4FJhFQJNQufyUkz3HVLxADO5TjVccmmVLZJfsHH0mWtL9LHsTsOahnMVfDxRnxEtFgoQ326wthjRISdDNTnV8tX87MLEs4vGFxXaKo96boeR5uoal/s320/Logging06.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Finally click on the OK button to save logging configuration.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step6&lt;/strong&gt;. Now you can validate your logging information by executing the SSIS package. To get more information about hoe to execute SSIS package, click &lt;a href=&quot;http://sql-bi-dev.blogspot.com/2012/09/different-ways-to-execute-ssis-packages.html&quot; target=&quot;_blank&quot;&gt;Different ways to Execute SSIS packages&lt;/a&gt;. My package looks like the picture shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG-tPZSVUNUQrGTb-i0RAAU_YwZRYzv3Gp8ZFbB2IQICoAucEe0BLWPVkhpJB8l2RR10RRq403AZPyAzh0PX_8_JsXGMMBToje09YNQULeqSw7U9B7B140CXQB0_C4TfApPLdPaxPUEIna/s1600/Logging08.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG-tPZSVUNUQrGTb-i0RAAU_YwZRYzv3Gp8ZFbB2IQICoAucEe0BLWPVkhpJB8l2RR10RRq403AZPyAzh0PX_8_JsXGMMBToje09YNQULeqSw7U9B7B140CXQB0_C4TfApPLdPaxPUEIna/s320/Logging08.PNG&quot; width=&quot;271&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
You&amp;nbsp;can see the log in sysSSISLog table after executing the package.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;*&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;Test&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;dbo&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;sysssislog&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAqd0ISAj_ldfSCP6vw9K5sgUXEDPvgYDrptykGa_uPeZKAXpkJHHXmCi2hY-VLw7QhLKtPD0umHFtcZ7qkUyTT8NtphIrtN8-UBRxpS1QqHR_asvhR-bKoAeSNuDOPMapwbhkCtrdw3DB/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;53&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAqd0ISAj_ldfSCP6vw9K5sgUXEDPvgYDrptykGa_uPeZKAXpkJHHXmCi2hY-VLw7QhLKtPD0umHFtcZ7qkUyTT8NtphIrtN8-UBRxpS1QqHR_asvhR-bKoAeSNuDOPMapwbhkCtrdw3DB/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;em&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&lt;em&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/10/ssis-logging.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzz_yt0Vqqfzpy2hI65Ii80F0uWfzOAsgGyHRCYGPpHfGukVnjBggiCLXM0W_6zF20kgqM3E7Q69p-FacfCfVj-zdyIikfvwqvhwzC5hy9OmA5zZj3YfRAEh4iWeICtMoY9olWBFHS1AW6/s72-c/Logging01.PNG" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-9186400617450078101</guid><pubDate>Tue, 02 Oct 2012 05:00:00 +0000</pubDate><atom:updated>2012-10-01T22:54:45.075-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>How to find missing Identity/Sequence numbers using T-SQL?</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;SQL Developers, did you ever come across a situation where
you need to find missing identity or sequence number for a given table? For
instance, someone deleted few records from a table which has an IDENTITY column.
Have you wondered how to find those missing rows? In this blogpost, I am going
to explain different ways to &lt;strong&gt;find missing identity or sequence numbers&lt;/strong&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;First I will create some sample data for demonstration
purpose.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- Prepare Test data --&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NOCOUNT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;dbo.TestData&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;IDENTITY&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 1&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Counter&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WHILE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Counter&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;=&lt;/span&gt; 15&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Counter&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+=&lt;/span&gt; 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: teal; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuJ5qp0je2RaYnS8Ozagv_34Qoiu1xMiroUqwd-VcYSFit-PB4yghmQiAOuQN2tTSMUE8SPIbiMknGyF8un4lwen98YgfJ1n8NCsDLACndH0Y92t3A4l_0OPS4ChobNO4adxczhrF7tUxR/s1600/MissingIdentity1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuJ5qp0je2RaYnS8Ozagv_34Qoiu1xMiroUqwd-VcYSFit-PB4yghmQiAOuQN2tTSMUE8SPIbiMknGyF8un4lwen98YgfJ1n8NCsDLACndH0Y92t3A4l_0OPS4ChobNO4adxczhrF7tUxR/s1600/MissingIdentity1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;span style=&quot;font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Now lets delete some rows manualy:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- Now delete some records (IDs)&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DELETE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IN&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;3&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;7&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;8&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;10&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;12&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;13&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;--Verifiy the data&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBXacdKU_yJToXbNnj_2kat8g_FOaPb88k_yzZu9zQdW-hb3d9qu-l9BsxT2utb-ZcjQWGravFAz7Xh7JWIIJ8bE1_cnzH95swpjgZV_qzrYy6Uz02AKe-hZqa2huGYbRN4q6EFQBn1wAk/s1600/MissingIdentity2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBXacdKU_yJToXbNnj_2kat8g_FOaPb88k_yzZu9zQdW-hb3d9qu-l9BsxT2utb-ZcjQWGravFAz7Xh7JWIIJ8bE1_cnzH95swpjgZV_qzrYy6Uz02AKe-hZqa2huGYbRN4q6EFQBn1wAk/s1600/MissingIdentity2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: 12pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Below are three different ways to identity missing values.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Find
missing sequence numbers using Ranking Function:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- Option 1: Using Ranking function&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;ROW_NUMBER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OVER &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;column_id&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;from&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;columns&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LkUp&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;LEFT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LkUp&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;is&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;and&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 11.0pt; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Here
is the output:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 11.0pt; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoWYjD2oTv9jExs-1g5DLyqhHznJgxX2TTQ7YMQIjPWHvWe5Gl6rS5sqLhZnuYDif8cPblZLGq8JK6-31NALdI6TH4xJLJLXHHUVK3ght3C4pPraeY7rEgzdDWvVGGN7jz2TaLxNCM01wX/s1600/MissingIdentity3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoWYjD2oTv9jExs-1g5DLyqhHznJgxX2TTQ7YMQIjPWHvWe5Gl6rS5sqLhZnuYDif8cPblZLGq8JK6-31NALdI6TH4xJLJLXHHUVK3ght3C4pPraeY7rEgzdDWvVGGN7jz2TaLxNCM01wX/s1600/MissingIdentity3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 12pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 11.0pt; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- If there are less records in
sys.columns and &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- you need need larger result then use
CROSS JOIN&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;FROM &lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;ROW_NUMBER&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;OVER &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;c1&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;column_id&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;columns&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;c1&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;CROSS&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;columns&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;c2&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LkUp&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;LEFT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;LkUp&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;is&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;null&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;and&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;SeqID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;Find
missing sequence numbers using CTE:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- Option 2: Using Common Table
Expression&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WITH&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;CTE&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MaxID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 1 &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;ALL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt; 1&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MaxID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CTE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;MaxID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CTE&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;LEFT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;on&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CTE&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;is&lt;/span&gt;
&lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;Find
missing sequence numbers using &lt;a href=&quot;http://sql-question.blogspot.com/2012/10/what-is-tally-table-in-sql-server.html&quot; target=&quot;_blank&quot;&gt;Tally Table&lt;/a&gt;:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;This is the most prefered way out of all the above options.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-- Option 3: Using Tally Table&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: 9.5pt;&quot;&gt;-------------------------------------------&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MissingSeqID&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Tally&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;LEFT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;JOIN&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;TestData&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;td&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;NULL&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;ID&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;&lt;/span&gt;
&lt;span style=&quot;color: teal;&quot;&gt;@MaxID&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
﻿&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/10/how-to-find-missing-identitysequence.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuJ5qp0je2RaYnS8Ozagv_34Qoiu1xMiroUqwd-VcYSFit-PB4yghmQiAOuQN2tTSMUE8SPIbiMknGyF8un4lwen98YgfJ1n8NCsDLACndH0Y92t3A4l_0OPS4ChobNO4adxczhrF7tUxR/s72-c/MissingIdentity1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-450057924531123883</guid><pubDate>Mon, 17 Sep 2012 02:56:00 +0000</pubDate><atom:updated>2012-09-21T19:49:31.640-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>Different ways to Execute SSIS Packages</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
We have the following ways to execute SSIS packages:&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;DTExec Command Line Utility&lt;/li&gt;
&lt;li&gt;DTExecUI Windows Application&lt;/li&gt;
&lt;li&gt;SQL Server Agent&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;strong&gt;DTExec Command Line Utility&lt;/strong&gt;&lt;br /&gt;
SQL Server provides the command line tool &lt;strong&gt;DTExec.exe&lt;/strong&gt; which can be used to execute an SSIS package. DTExec can be run from a Command Prompt or from a batch (.BAT) file.&lt;br /&gt;
To begin, open a Command Prompt and navigate to the&amp;nbsp;project folder as shown below (I am taking an example of SalesForcastInput package from local directory &quot;&lt;em&gt;&lt;span style=&quot;color: #073763;&quot;&gt;D:\SSIS\Hari\Sample\SSIS-Sample1\SalesForcastInput.dtsx&lt;/span&gt;&lt;/em&gt;&quot;):&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhviqk-nRaoYiT400h9NGDE-0tnJ3KCWGXghDfv7tpJF1lMiZEV1JoyVkQUWPkMu4lt9LhLXGhP3Slq9ebqwLYr90TShjC53aqInNzY9ZpRrJsmNykiQGlSyFJf8F02gUCjIL-FE304315z/s1600/ExecuteSSIS1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;52&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhviqk-nRaoYiT400h9NGDE-0tnJ3KCWGXghDfv7tpJF1lMiZEV1JoyVkQUWPkMu4lt9LhLXGhP3Slq9ebqwLYr90TShjC53aqInNzY9ZpRrJsmNykiQGlSyFJf8F02gUCjIL-FE304315z/s320/ExecuteSSIS1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now type the following command to execute the SalesForecastInput.dtsx package:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;DTEXEC /FILE SalesForecastInput.dtsx&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
To see the complete list of command line options for DTEXEC, type following:&lt;br /&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;DTEXEC&amp;nbsp;&amp;nbsp; /?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;It is not necessary to navigate command prompt to package&amp;nbsp;directory before executing&amp;nbsp;&lt;strong&gt;DTExec&lt;/strong&gt; command; You can give the full path of your package as shown below:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: black; color: white;&quot;&gt;DTExec /f &quot;D:\SSIS\Hari\Sample\SSIS-Sample1\SalesForcastInput.dtsx&quot; /conf &quot;D:\SSIS\Hari\Sample\SSIS-Sample1\SalesForcastInput.dtsConfig&quot; /M -1&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here, /f (/File) parameter used to load&amp;nbsp;the package that is saved in the file system in your system. Likewise, /conf (/ConfigFile) parameter used to load the configuration file that is saved in the file system in your system. /M (/MaxConcurrent) specifies the number of executable files that the package can run concurrently.&lt;br /&gt;
&lt;br /&gt;
Click &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms162810(v=SQL.105).aspx&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; for more information about DTExec utility and it&#39;s parameters.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;DTExecUI Windows Application&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
SQL Server includes the Windows application &lt;strong&gt;DTExecUI.exe&lt;/strong&gt; which can be used to execute an SSIS package. DTExecUI provides a graphical user interface that can be used to specify the various options to be set when executing an SSIS package. You can launch DTEXECUI by double-clicking on an SSIS package file (.dtsx).&lt;br /&gt;
To begin, navigate to the your project folder. Double-click on the package (For instance, SalesForecastInput.dtsx in my example) and you will see the following multi-page dialog displayed:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsFmkqjeK44Z6UAi-Q02ZrUAva_GgueoAT8iR2E56Tmz3TKALy8uKfNzrl_Wc67acw2UZ0g12bCJR85Hl80gm1NrhADuvwfWlx6FlwWYpUx11nC3N3Pwb-a-EWEbg3xjumgWBhp_AP4zSi/s1600/ExecuteSSIS2.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsFmkqjeK44Z6UAi-Q02ZrUAva_GgueoAT8iR2E56Tmz3TKALy8uKfNzrl_Wc67acw2UZ0g12bCJR85Hl80gm1NrhADuvwfWlx6FlwWYpUx11nC3N3Pwb-a-EWEbg3xjumgWBhp_AP4zSi/s320/ExecuteSSIS2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see there are many settings available when you use this utility. As a general rule you can simply click the Execute button to run your package. You can also fine tune your execution by clicking through the various screens and entering your own settings. After changing the settings click on Command Line which will show you the DTExec command line based on the settings you have chosen.&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: If you have a configuration file which is not configured at package level, then do not forget to add the configuration file through &lt;strong&gt;Configurations&lt;/strong&gt; setting.&lt;/em&gt;&lt;br /&gt;
&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Scheduling SSIS Package through SQL Server Agent&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
SQL Server Agent includes the SQL Server Integration Services Package job step type which allows you to execute an SSIS package in a SQL Server Agent job step. This can be especially handy as it allows you to schedule the execution of SSIS package so that it runs without any user interaction.&lt;br /&gt;
To begin, open &lt;strong&gt;SQL Server Management Studio&lt;/strong&gt; (SSMS), connect to the Database Engine, and drill down to the &lt;strong&gt;SQL Server Agent&lt;/strong&gt; node in the Object Explorer. Right click on the &lt;strong&gt;Jobs&lt;/strong&gt; node and select &lt;strong&gt;New Job&lt;/strong&gt; from the popup menu. Go to the &lt;strong&gt;Steps&lt;/strong&gt; page, click &lt;strong&gt;New&lt;/strong&gt;, and fill in the dialog as shown below:&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwa7atbEAT9ossQm6hCCdoKYoyixqotCl8F0Tbjgfyw_f5BylDrycoeIrHX0fuRBt5AMtjNce0fZCHdGEFtBlcQgJC6ozLWYeFwo0WCGXArrFWfEcCAepXnAj28CnH-nlXr5RGRZ9VUkWX/s1600/ExecuteSSIS3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;286&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwa7atbEAT9ossQm6hCCdoKYoyixqotCl8F0Tbjgfyw_f5BylDrycoeIrHX0fuRBt5AMtjNce0fZCHdGEFtBlcQgJC6ozLWYeFwo0WCGXArrFWfEcCAepXnAj28CnH-nlXr5RGRZ9VUkWX/s320/ExecuteSSIS3.png&quot; width=&quot;320&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwa7atbEAT9ossQm6hCCdoKYoyixqotCl8F0Tbjgfyw_f5BylDrycoeIrHX0fuRBt5AMtjNce0fZCHdGEFtBlcQgJC6ozLWYeFwo0WCGXArrFWfEcCAepXnAj28CnH-nlXr5RGRZ9VUkWX/s1600/ExecuteSSIS3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwa7atbEAT9ossQm6hCCdoKYoyixqotCl8F0Tbjgfyw_f5BylDrycoeIrHX0fuRBt5AMtjNce0fZCHdGEFtBlcQgJC6ozLWYeFwo0WCGXArrFWfEcCAepXnAj28CnH-nlXr5RGRZ9VUkWX/s1600/ExecuteSSIS3.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;div align=&quot;left&quot;&gt;
﻿&lt;/div&gt;
&lt;/a&gt;In the above example, the SSIS package to be executed is deployed to SQL Server (i.e. the MSDB database). You can also execute packages deployed to the file system or the SSIS package store.
Note that the Run as setting is the SQL Agent Service Account. This is the default setting although from a security standpoint it may not be what you want. You can setup a Proxy that allows you to give a particular credential permission to execute an SSIS package from a SQL Server Agent job step.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQRmwzkdeGf4D0duzTG2rFHQ2K1CP80cqTs49FHrZZ1STVvsTWijcGUc6iCmHRlqNR3P9yznB9jMEfORcKfTYw6_el4YG-hxPsegOHREV6bjf4SbUNaZEfXreebckIXGVT5tVQybnERkaY/s1600/ExecuteSSIS4.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQRmwzkdeGf4D0duzTG2rFHQ2K1CP80cqTs49FHrZZ1STVvsTWijcGUc6iCmHRlqNR3P9yznB9jMEfORcKfTYw6_el4YG-hxPsegOHREV6bjf4SbUNaZEfXreebckIXGVT5tVQybnERkaY/s1600/ExecuteSSIS4.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQRmwzkdeGf4D0duzTG2rFHQ2K1CP80cqTs49FHrZZ1STVvsTWijcGUc6iCmHRlqNR3P9yznB9jMEfORcKfTYw6_el4YG-hxPsegOHREV6bjf4SbUNaZEfXreebckIXGVT5tVQybnERkaY/s320/ExecuteSSIS4.png&quot; width=&quot;290&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/09/different-ways-to-execute-ssis-packages.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhviqk-nRaoYiT400h9NGDE-0tnJ3KCWGXghDfv7tpJF1lMiZEV1JoyVkQUWPkMu4lt9LhLXGhP3Slq9ebqwLYr90TShjC53aqInNzY9ZpRrJsmNykiQGlSyFJf8F02gUCjIL-FE304315z/s72-c/ExecuteSSIS1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-8258451876358973155</guid><pubDate>Sat, 01 Sep 2012 08:00:00 +0000</pubDate><atom:updated>2012-09-01T01:00:00.885-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server 2012</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title></title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;strong&gt;Columnstore Index&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;u&gt;Columnstore &lt;/u&gt;index was introduced in the SQL Server 2012 to
significantly speed-up the processing time of common data warehousing queries. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Generally data warehousing workloads involve summarizing large volume of data. As you might know, we use different techniques in data-warehousing (DW) and decision support systems (DSS) to improve performance like
pre-computed summary tables, indexed views, OLAP cubes etc. Although, these
techniques greatly speed up query the data processing but they have some side
effects. These techniques can be inflexible, hard to maintain, and must be
designed specifically for specific query problem.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;Data warehousing processing overhead can be significantly reduced by using SQL Server &lt;strong&gt;Columnstore&lt;/strong&gt; index. Not only that, columnstore indexes reduces the overhead of the other solutions. Columnstore indexes also enable queries to compute the results quickly so that pre-computation is not required.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;strong&gt;Characterisitcs of SQL Server Columnstore Indexes:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Columnar data format&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – unlike the traditional row based organization of data (called &lt;span class=&quot;parameter1&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;em&gt;rowstore&lt;/em&gt;&lt;/span&gt;&lt;/span&gt; format),&amp;nbsp;&lt;strong&gt;columnstore&lt;/strong&gt; indexes group and store data&amp;nbsp;in one column at a time. SQL Server query processing can take advantage of this new data
layout and significantly improve query execution time.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Faster query results&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – Columnstore indexes can produce faster results for the
following reasons:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 1in; mso-list: l0 level2 lfo1; tab-stops: list 1.0in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;o&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Only the columns needed must be read. Therefore, less data is read
from disk to memory and then from memory to processor cache.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 1in; mso-list: l0 level2 lfo1; tab-stops: list 1.0in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;o&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Columns are heavily compressed. This reduces the number of bytes
that must be read and moved and hence less I/O operations.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 1in; mso-list: l0 level2 lfo1; tab-stops: list 1.0in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;o&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Most queries do not touch all columns of the table. Therefore,
many columns will never be brought into memory. This, combined with excellent
compression, improves buffer pool usage, which reduces total I/O.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 1in; mso-list: l0 level2 lfo1; tab-stops: list 1.0in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10pt; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;o&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Advanced query execution technology processes chunks of columns
called &lt;span class=&quot;parameter1&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; mso-ansi-font-size: 11.0pt; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-font-size: 11.0pt; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;em&gt;batches&lt;/em&gt;&lt;/span&gt;&lt;/span&gt; in a streamlined manner,
reducing CPU usage.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 60pt; mso-list: l0 level2 lfo1; tab-stops: list 1.0in; text-align: left; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Key columns&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – There is no concept of key columns in a columnstore index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Clustered index key&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; –&amp;nbsp;all the columns of clustered index must be present in the nonclustered columnstore index. If a column
in the clustering key is not listed in the create index statement, it will be
added to the columnstore index automatically.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Partitioning&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – Columnstore indexes works with table partitioning. No change to
the table partitioning syntax is required. Albeit, nonclustered
columnstore index can only be created on a partitioned table if the
partitioning column is part of the columnstore index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Record Size&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – There is no&amp;nbsp;index key record size limitation on columnstore indexes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Query processing&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – Along with the columnstore index, SQL Server introduces batch
processing to take advantage of the columnar orientation of the data. The columnstore
structure and batch processing both contribute to performance gains.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Table cannot be
updated&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt; – For SQL Server 2012, a table with a columnstore
index cannot be updated.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri; font-size: large;&quot;&gt;&lt;strong&gt;How to create Columnstore Index:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Columnstore index can be create using SQL Server Management Studio as well as using T-SQL. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;strong&gt;Creating Columnstore index by using SQL Server Management Studio (SSMS):&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;div style=&quot;margin-left: 0.5in; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;Open Management Studio and&amp;nbsp;use Object Explorer to connect to the SQL Server Database Engine.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;In Object Explorer, expand the instance of SQL Server, expand &lt;span class=&quot;label&quot;&gt;Databases&lt;/span&gt;, expand a database, expand a table, right-click on required
table, point to &lt;span class=&quot;label&quot;&gt;New Index&lt;/span&gt;, and then click &lt;span class=&quot;label&quot;&gt;Non-Clustered Columnstore Index&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;In the &lt;span class=&quot;label&quot;&gt;Index name&lt;/span&gt; dialog box, under the &lt;span class=&quot;label&quot;&gt;General&lt;/span&gt; tab, type a name for the new index, and then click &lt;span class=&quot;label&quot;&gt;Add&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 0.5in; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Segoe UI&amp;quot;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;4.&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;In the &lt;span class=&quot;label&quot;&gt;Select Columns&lt;/span&gt; dialog box, select
the columns to participate in the columnstore index, and then click &lt;span class=&quot;label&quot;&gt;OK&lt;/span&gt; two times to create the index.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXyhzyfCRoATCh-PkhWlN0W-e-SrztzvZ5bZYJ-gMLhmFlG3nU0iDSg8FpJBzaT-bGffdLYZCGtN5Qlw8QzBif8ieZAs1bcK1ATqAYuXIVjmbBSrnHsvukGjcUBB2tBIeumrcIuZOWojiq/s1600/Columnstore+Index.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;287&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXyhzyfCRoATCh-PkhWlN0W-e-SrztzvZ5bZYJ-gMLhmFlG3nU0iDSg8FpJBzaT-bGffdLYZCGtN5Qlw8QzBif8ieZAs1bcK1ATqAYuXIVjmbBSrnHsvukGjcUBB2tBIeumrcIuZOWojiq/s320/Columnstore+Index.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;strong&gt;Creating Columnstore index by using T-SQL:&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Create columnstore index on Employee table, name it CSI_Employee, and include all the columns!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span class=&quot;label&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;-- Check whether index CSI_Employee exists on Employee&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;-- and delete if exists. &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: grey;&quot;&gt;EXISTS(&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;name&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;indexes&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;dbo.Employee&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;name&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;CSI_Employee&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INDEX&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CSI_Employee&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Employee&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;GO&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;-- Create nonclustered columnstore index CSI_Employee on
Employee.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NONCLUSTERED&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;COLUMNSTORE&lt;/span&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INDEX&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;CSI_Employee&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Employee&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;EmployeeID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;FirstName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;MiddleName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;LastName&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DOB&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;DepartmentID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(242, 242, 242); line-height: normal; margin: 0in 0in 0pt; mso-background-themecolor: background1; mso-background-themeshade: 242; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;

&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-size: 9.5pt;&quot;&gt;Data
Types&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;


&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;Columnstore index support some data-types and doesn&#39;t support others. You need to be aware of this while creating columnstore index to avoid any run time errors.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;The
following &lt;strong&gt;data types can be included&lt;/strong&gt; in a columnstore index:&lt;/span&gt;
&lt;strong&gt;

&lt;/strong&gt;&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;char&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;varchar&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;nchar&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;nvarchar&lt;/span&gt; (except &lt;span class=&quot;input1&quot;&gt;varchar(max)&lt;/span&gt; and
&lt;span class=&quot;input1&quot;&gt;nvarchar(max)&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;decimal&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; (and &lt;span class=&quot;input1&quot;&gt;numeric&lt;/span&gt;) (Except with precision greater than 18 digits.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;, &lt;span class=&quot;input1&quot;&gt;bigint&lt;/span&gt;, &lt;span class=&quot;input1&quot;&gt;smallint&lt;/span&gt;, and &lt;span class=&quot;input1&quot;&gt;tinyint&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;float&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; (and &lt;span class=&quot;input1&quot;&gt;real&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;bit&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;money&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;smallmoney&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l0 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;All date and time data types (except &lt;span class=&quot;input1&quot;&gt;datetimeoffset&lt;/span&gt;
with scale greater than 2)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;strong&gt;

&lt;/strong&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;The
following &lt;strong&gt;data types cannot be included&lt;/strong&gt; in a columnstore index:&lt;/span&gt;


&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;binary&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;varbinary&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;ntext&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;, &lt;span class=&quot;input1&quot;&gt;text&lt;/span&gt;, and &lt;span class=&quot;input1&quot;&gt;image&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;varchar(max)&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;nvarchar(max)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;uniqueidentifier&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;span class=&quot;input1&quot;&gt;timestamp&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;sql_variant&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;decimal&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; and &lt;span class=&quot;input1&quot;&gt;numeric&lt;/span&gt; with precision greater than 18 digits&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;input1&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;datetimeoffset&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt; with
scale greater than 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;CLR types (&lt;span class=&quot;input1&quot;&gt;hierarchyid&lt;/span&gt; and spatial
types)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;xml&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-left: 30pt; mso-list: l1 level1 lfo2; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;a href=&quot;javascript:void(0)&quot; title=&quot;Collapse&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2; text-decoration: none; text-underline: none;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Columnstore
Index Restrictions and Limitations&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;b&gt;&lt;span style=&quot;color: #1f497d; font-size: 13pt; line-height: 115%; mso-bidi-font-size: 11.0pt; mso-themecolor: text2;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;There are certain restrictions and limitations on columnstore indexes which are listed below:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Columnstor index cannot have more than
1024 columns.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Columnstor index annot be clustered or unique.
Only nonclustered columnstore indexes are available.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Columnstor index c&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;annot be created on a
view or indexed view.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Cannot include columns of restricted data-types as mentioned above.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Cannot act as a primary
key or a foreign key.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Cannot be changed using
the ALTER INDEX statement. Drop and re-create the columnstore index
instead.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Cannot be created with
the INCLUDE keyword.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Cannot include the ASC
or DESC keywords for sorting the index. Columnstore indexes are ordered
according to the compression algorithms.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 30pt; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black; font-family: Symbol; font-size: 10pt; mso-bidi-font-family: Symbol; mso-bidi-font-size: 9.5pt; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font-size-adjust: none; font-stretch: normal; font: 7pt/normal &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 9.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Does not use or keep
statistics in the manner of a traditional index.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;: You can compare the performance optimization be executing heavy volume queries before and after creating columnstore index. You might get 50% to 90% performance gain!&lt;/em&gt;&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/09/columnstore-index-columnstore-index-was.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXyhzyfCRoATCh-PkhWlN0W-e-SrztzvZ5bZYJ-gMLhmFlG3nU0iDSg8FpJBzaT-bGffdLYZCGtN5Qlw8QzBif8ieZAs1bcK1ATqAYuXIVjmbBSrnHsvukGjcUBB2tBIeumrcIuZOWojiq/s72-c/Columnstore+Index.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-3684415743375857267</guid><pubDate>Wed, 22 Aug 2012 02:00:00 +0000</pubDate><atom:updated>2012-09-30T11:12:42.364-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">SQL Server 2012</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title></title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;Introducing
&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: magenta; font-family: Consolas; line-height: 115%; mso-bidi-font-size: 9.5pt;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; line-height: 115%; mso-bidi-font-size: 9.5pt;&quot;&gt;() &lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: 15pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;To&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;SQL Server
Family&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: magenta; font-family: Consolas; font-size: 10.5pt; mso-bidi-font-size: 9.5pt;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.5pt; mso-bidi-font-size: 9.5pt;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt; is a brand new logical function introduced with SQL
Server 2012 that allows you to perform &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt; conditional statements within a single function. Behavior
of this function is similar to any other programming language IIF() function!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;In earlier versions of SQL Server, we have used &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;
and &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;CASE WHEN&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;...&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;END &lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;to
perform logical conditional operations. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;color: magenta; font-family: Consolas; font-size: 10.5pt; line-height: 115%; mso-bidi-font-size: 9.5pt;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: 10.5pt; line-height: 115%; mso-bidi-font-size: 9.5pt;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt; can be handy for writing conditional CASE
statements in a single function. It evaluates the expression passed in the
first parameter and returns either TRUE or FALSE. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;--Example1:  Repalcement of simple IF...ELSE statement&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Grade&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CHAR&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;A&#39;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Grade&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;F&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;Failed&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;Passed&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;) &lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;Result&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;Here is the  output of above T-SQL code:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3SpOs-17RNautHGvctesrbdW42897D5yOJej-1cRDYXsIRTqD_JFSwb-g1216G64flKarI4qf4ZDtQ-TmmIdOUhyG-9n5OOSrXmLof1o4EP1T4SZDIMP0ZHK8Dv3ffDH-4kCQVkq8TyR4/s1600/IIF.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;115&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3SpOs-17RNautHGvctesrbdW42897D5yOJej-1cRDYXsIRTqD_JFSwb-g1216G64flKarI4qf4ZDtQ-TmmIdOUhyG-9n5OOSrXmLof1o4EP1T4SZDIMP0ZHK8Dv3ffDH-4kCQVkq8TyR4/s400/IIF.PNG&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;--Example2: Nested  IIF()&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Percent&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECIMAL&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;5&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; 2&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;50&#39;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Percent&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt; 80&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;A&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Percent&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt; 60&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;B&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;C&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;))&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;Here is the  output of above T-SQL code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;----&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;C&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;(1 row(s) affected)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9pt;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: small;&quot;&gt;-- Example3: In this  example, we will evaluate the marks obtained &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;-- by Smith and Hari &lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;and identify who  got higer marks between them.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Smith_Marks&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 72&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Hari_Marks&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt; 86&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;span style=&quot;color: magenta;&quot;&gt;IIF&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Smith_Marks&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: teal;&quot;&gt;@Hari_Marks&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;,CONCAT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Smith got &#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Smith_Marks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Hari_Marks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39; marks higher than Hari&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;,CONCAT&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Hari got &#39;&lt;/span&gt; &lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Hari_Marks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;@Smith_Marks&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39; marks higher than Smith&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: small;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: 115%; margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri; font-size: small;&quot;&gt;Here is the  output:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;---------------------------------------------&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: small;&quot;&gt;Hari got 14 marks higher than Smith&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: small;&quot;&gt;(1 row(s) affected)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/08/introducing-iif-to-sql-serverfamily-iif.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3SpOs-17RNautHGvctesrbdW42897D5yOJej-1cRDYXsIRTqD_JFSwb-g1216G64flKarI4qf4ZDtQ-TmmIdOUhyG-9n5OOSrXmLof1o4EP1T4SZDIMP0ZHK8Dv3ffDH-4kCQVkq8TyR4/s72-c/IIF.PNG" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-5594869835202539299</guid><pubDate>Sun, 05 Aug 2012 06:00:00 +0000</pubDate><atom:updated>2012-08-04T23:15:11.025-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server 2012</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title></title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #660000; font-size: large;&quot;&gt;&lt;strong&gt;SQL Server 2012 Analytical Functions: Lead and Lag&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;SQL Server 2012 supports many T-SQL analytic functions which are listed below:&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;LEAD&lt;/strong&gt;: Accesses data from a subsequent row in the same result set without the use of a self-join.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;LAG&lt;/strong&gt;: Accesses data from a previous row in the same result set without the use of a self-join.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;CUME_DIST&lt;/strong&gt;: Calculates the cumulative distribution of a value in a group of values. In other words, CUME_DIST computes the relative position of a specified value in a group of values&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;FIRST_VALUE&lt;/strong&gt;: Returns the first value in an ordered set of values.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;LAST_VALUE&lt;/strong&gt;: Returns the last value in an ordered set of values.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;PERCENTILE_CONT&lt;/strong&gt;: Calculates a percentile based on a continuous distribution of the column.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;PERCENTILE_DISC&lt;/strong&gt;: Computes a specific percentile for sorted values in an entire rowset or within distinct partitions of a rowset.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;PERCENT_RANK&lt;/strong&gt;: Calculates the relative rank of a row within a group of rows.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Analytic functions compute an aggregate value based on a group of rows. However, unlike aggregate functions, they can return multiple rows for each group. You can use analytic functions to compute moving averages, running totals, percentages or top-N results within a group.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;In this article, we are going to focus only on &lt;strong&gt;Lead&lt;/strong&gt; and &lt;strong&gt;Lag&lt;/strong&gt; functions. &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;Lead&lt;/strong&gt; function accesses data from a subsequent row and &lt;strong&gt;Lag&lt;/strong&gt; function accesses from previous row&amp;nbsp;in the same result set without the use of a self-join.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;Syntax&lt;/strong&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;LEAD | Lag ( scalar_expression [ ,offset ] , [ default ] ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OVER ( [ partition_by_clause ] order_by_clause )&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span class=&quot;parameter&quot;&gt;&lt;strong&gt;scalar_expression &lt;/strong&gt;is the&lt;/span&gt; value to be returned based on the specified offset. &lt;strong&gt;Offset &lt;/strong&gt;specify the number of rows forward/backward from the current row from which to obtain a value. &lt;strong&gt;Default &lt;/strong&gt;is the value to return when &lt;span class=&quot;parameter&quot;&gt;scalar_expression&lt;/span&gt; at &lt;span class=&quot;parameter&quot;&gt;offset&lt;/span&gt; is NULL.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Now lets explorer Lead function with an example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;Problem&lt;/strong&gt;: Compare values between current year, previors year, and next year.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
---------------------&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
-- Prepare Test Data&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
---------------------&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
DECLARE &lt;span style=&quot;color: teal;&quot;&gt;@TestData&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;TABLE &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Period&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;DATE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;INSERT &lt;span style=&quot;color: teal;&quot;&gt;@TestData&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2006-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 1000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2007-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 3000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2008-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 5000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2009-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 4000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2010-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 7000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2011-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 6000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
SELECT &lt;span style=&quot;color: red;&quot;&gt;&#39;2012-12-31&#39; &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt; 8000 &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;----------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
-- Fetch current year, previous year, and next year data&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
----------------------------------------------------------&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;SELECT &lt;span style=&quot;color: teal;&quot;&gt;Period&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;CurrentAmount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;LAG&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;OVER &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;ORDER&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;BY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Period&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;PreviousAmount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;LEAD&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Amount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;OVER &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;ORDER&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;BY&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;Period&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;AS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas; font-size: x-small;&quot;&gt;NextAmount&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
FROM &lt;span style=&quot;color: teal;&quot;&gt;@TestData&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihR-ch1nB2iYVjG4EZBO78h_GSoSggNcslycjWXi-SjqeCaRcG5IZZB8M0RaaNZl4lF_72z00awn2paRL4bi9os00zdPSRJWmHNNzfblUqWBiQ68Ifnf-AHHecD2Hb-SNCMhyG-vmsNEzI/s1600/Data.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;127&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihR-ch1nB2iYVjG4EZBO78h_GSoSggNcslycjWXi-SjqeCaRcG5IZZB8M0RaaNZl4lF_72z00awn2paRL4bi9os00zdPSRJWmHNNzfblUqWBiQ68Ifnf-AHHecD2Hb-SNCMhyG-vmsNEzI/s400/Data.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: x-small;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Note that in the above we have set the default vaule 0 for Lead and Lag functions so we are getting zero (0) instead of NULL.﻿ Also we have set the offset to 1 for lead and lag function so we are getting only subsequent&amp;nbsp; and previous values. Offset can be set as per requirement but in most of the cases we use 1.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;For more information on Analytical Functions, please click&lt;/span&gt; &lt;a href=&quot;http://technet.microsoft.com/en-us/library/hh213234(v=SQL.110).aspx&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;/div&gt;</description><link>http://sql-bi-dev.blogspot.com/2012/08/sql-server-2012-analytical-functions.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihR-ch1nB2iYVjG4EZBO78h_GSoSggNcslycjWXi-SjqeCaRcG5IZZB8M0RaaNZl4lF_72z00awn2paRL4bi9os00zdPSRJWmHNNzfblUqWBiQ68Ifnf-AHHecD2Hb-SNCMhyG-vmsNEzI/s72-c/Data.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-605106442761973091</guid><pubDate>Sat, 28 Jul 2012 06:41:00 +0000</pubDate><atom:updated>2012-09-24T22:14:02.793-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server 2012</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title></title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #262626; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 18pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;CONCAT()
IN SQL SERVER 2012&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #262626; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 18pt; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;color: black; font-family: Times New Roman; font-size: small;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #262626;&quot;&gt;SQL Server 2012&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #262626;&quot;&gt; introduces a new string function CONCAT() which allows you to concatenate up to 255 string or variable
values in to one single string. It requires a minimum of two input values. Good thing about the function is that it takes care of implicitly converting the data values to
a string by following the data type conversion rules of SQL Server 2012. This
function would help eliminate the need of explicit data conversions when
concatenating two values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #262626;&quot;&gt;Note:&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #262626;&quot;&gt; NULL values are implicitly converted to an empty string.
If all the variables passed as parameters in CONCAT function are NULL, an empty
string of type VARCHAR(1) is returned. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;SYNTAX: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;CONCAT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;String_Value1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;String_Value2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;String_Value3&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;[, String_ValueN]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: green; font-family: Consolas;&quot;&gt;-- Between 2 and 254 values can be passed.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;EXAMPLE:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;strong&gt;

&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;DECLARE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@FirstName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;NVARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;N&#39;हरि&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@LastNameVARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;10&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;Sharma&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Cell&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;20&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&#39;+1 (425) XXX-YYYY&#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: red; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Age&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;INT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; 30&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Delimiter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;VARCHAR&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;SPACE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas;&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: magenta; font-family: Consolas;&quot;&gt;CONCAT&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@FirstName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Delimiter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@LastName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Delimiter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Cell&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Delimiter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: teal; font-family: Consolas;&quot;&gt;@Age&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;&lt;span style=&quot;color: grey; font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;OUTPUT:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Consolas;&quot;&gt;&lt;span style=&quot;font-family: Consolas;&quot;&gt;　&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglWgvYAfv40GP0WGiJq3vm7PeaviFR30EO2lhM6KsB6CZ7lzpRPjqwXCnERrTv2jIiy0kD6o7hQlGS8THwzihzBXuUscrBX5uqTjZS0SyN2Sbpixf5D9l4ag00DUWeukEsYtxHiPiNVWpm/s1600/Concat.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglWgvYAfv40GP0WGiJq3vm7PeaviFR30EO2lhM6KsB6CZ7lzpRPjqwXCnERrTv2jIiy0kD6o7hQlGS8THwzihzBXuUscrBX5uqTjZS0SyN2Sbpixf5D9l4ag00DUWeukEsYtxHiPiNVWpm/s1600/Concat.PNG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;You might have observed that there’s no data conversion being performed in the above example.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;The data returned by CONCAT function depends on the type of valued passed. Below are some of the mapping input and output types:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: #262626;&quot;&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; margin: auto auto auto 99.6pt; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;tbody&gt;
&lt;tr style=&quot;mso-yfti-firstrow: yes; mso-yfti-irow: 0;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background: rgb(221, 217, 195); border: 1pt solid windowtext; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Input Value / Type&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background: rgb(221, 217, 195); border-color: windowtext windowtext windowtext rgb(0, 0, 0); border-style: solid solid solid none; border-width: 1pt 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Output Value / Type&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;
&lt;tr style=&quot;mso-yfti-irow: 1;&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext; border-style: none solid solid; border-width: 0px 1pt 1pt; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SQL-CLR (TYPES &amp;amp; UDT)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); border-style: none solid solid none; border-width: 0px 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;
&lt;tr style=&quot;mso-yfti-irow: 2;&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext; border-style: none solid solid; border-width: 0px 1pt 1pt; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); border-style: none solid solid none; border-width: 0px 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;
&lt;tr style=&quot;mso-yfti-irow: 3;&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext; border-style: none solid solid; border-width: 0px 1pt 1pt; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(&amp;lt;=4000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); border-style: none solid solid none; border-width: 0px 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(&amp;lt;=4000)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;
&lt;tr style=&quot;mso-yfti-irow: 4;&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext; border-style: none solid solid; border-width: 0px 1pt 1pt; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;VARBINARY(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); border-style: none solid solid none; border-width: 0px 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;NVARCHAR(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;
&lt;tr style=&quot;mso-yfti-irow: 5; mso-yfti-lastrow: yes;&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext; border-style: none solid solid; border-width: 0px 1pt 1pt; padding: 0in 5.4pt; width: 184.5pt;&quot; valign=&quot;top&quot; width=&quot;246&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;ALL OTHER INPUT TYPES&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;td style=&quot;background-color: transparent; border-color: rgb(0, 0, 0) windowtext windowtext rgb(0, 0, 0); border-style: none solid solid none; border-width: 0px 1pt 1pt 0px; padding: 0in 5.4pt; width: 202.5pt;&quot; valign=&quot;top&quot; width=&quot;270&quot;&gt;&lt;span style=&quot;color: #0c343d; font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Segoe UI&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;VARCHAR(&amp;lt;=8000) *Unless one of the parameters is an NVARCHAR
  of any length and in that case, the output value would be in NVARCHAR(MAX)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
  &lt;/span&gt;&lt;/td&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
 &lt;/span&gt;&lt;/tr&gt;
&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;
&lt;/span&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;NOTE&lt;/span&gt;: CONCAT function only works with SQL Server 2012 and later 
versions.&lt;/span&gt;&lt;span style=&quot;color: black; font-family: Times New Roman;&quot;&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;/b&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2012/07/concatin-sql-server-2012-sql-server.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglWgvYAfv40GP0WGiJq3vm7PeaviFR30EO2lhM6KsB6CZ7lzpRPjqwXCnERrTv2jIiy0kD6o7hQlGS8THwzihzBXuUscrBX5uqTjZS0SyN2Sbpixf5D9l4ag00DUWeukEsYtxHiPiNVWpm/s72-c/Concat.PNG" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-2211718498891035789</guid><pubDate>Sun, 11 Dec 2011 04:07:00 +0000</pubDate><atom:updated>2012-08-21T20:15:09.160-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Cube</category><category domain="http://www.blogger.com/atom/ns#">Degenerate Dimension</category><title>Creating Degenerated dimension</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;border: currentColor;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;Degenerate Dimensions&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;border: currentColor;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
In a data warehouse, a &lt;strong&gt;degenerate dimension&lt;/strong&gt; is a dimension which is &lt;u&gt;derived from the fact table&lt;/u&gt; and &lt;u&gt;doesn&#39;t have its own dimension table&lt;/u&gt;. Degenerate dimensions are often used when a fact table&#39;s grain represents transactional level data and one wishes to maintain system specific identifiers such as order numbers, invoice numbers and the like without forcing their inclusion in their own dimension. The decision to use degenerate dimensions is often based on the desire to provide a direct reference back to a transactional system without the overhead of maintaining a separate dimension table.&lt;br /&gt;
&lt;br /&gt;
Once a cube is created, we can add degenerate dimension to the cube. &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;u&gt;&lt;strong&gt;Below are the steps to create Degenerate Dimension:&lt;/strong&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
1. Click on &lt;em&gt;Add Cube Dimension&lt;/em&gt; icon in Dimension Usage tab as shown below. It will open &lt;strong&gt;Add Cube Dimension&lt;/strong&gt; dialogue box. &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg26zJYwFwnIBCdUkzF49rsP6a62XuZ5XPsjQ9UwlFL6dVPOrxFHAlAVYdrrETAjF0elMTUtUHb-6HpkRLbCyLkjmbiNSyTt064jxiSzQiWzLPgrJojAdkynaBJDNYNH5wgRQX_ydZhDxHd/s1600/Pic1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg26zJYwFwnIBCdUkzF49rsP6a62XuZ5XPsjQ9UwlFL6dVPOrxFHAlAVYdrrETAjF0elMTUtUHb-6HpkRLbCyLkjmbiNSyTt064jxiSzQiWzLPgrJojAdkynaBJDNYNH5wgRQX_ydZhDxHd/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
2. Click on &lt;strong&gt;New dimension&lt;/strong&gt;… button in &lt;strong&gt;Add Cube Dimension&lt;/strong&gt; dialogue box. &lt;/div&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn7rUA68aIUHL1LkxjVpPLFWqrkGQHgBl4mg8szCXB9Qn6XaIf-it1qTofdcGjlJbGTHz7hhu1-8Q3BP1m8quZxNlOX86gxYEFEpMAZkkCt7C6u4oaVhd-wXsgqAUwkMx_dwC8trfZIgCw/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. It will open &lt;strong&gt;Dimension Wizard&lt;/strong&gt;. Click on &lt;strong&gt;Next&lt;/strong&gt; to continue… &lt;br /&gt;
4. Select required &lt;strong&gt;data source view&lt;/strong&gt; and click on &lt;strong&gt;Next&lt;/strong&gt; to continue… &lt;br /&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFgy6KM4FGwBOydh_jPF_bZDfZgr8SKht4qR3EgJeI9H7zxUYLanS61k15T4Tg7_1lZlK40uFOv0Wgs8a2V5hZ6fep64rsUK_ub3UzI3UUC_I57XY2msTvZrreLYti7BUQjDYfGjGHnBTG/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Select &lt;strong&gt;Standard dimension&lt;/strong&gt; option and click on &lt;strong&gt;Next &lt;/strong&gt;to continue… &lt;br /&gt;
6. Select &lt;strong&gt;Main Dimension&lt;/strong&gt; table and &lt;strong&gt;Key columns&lt;/strong&gt;. Click on &lt;strong&gt;Next&lt;/strong&gt; to continue…&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7OM1wvtMuyuFQhGM_H5mROYFTUPz0VHIlr_RaqPL3SbGfvfR6Yq9Q5XVogAr6kwL1NHBKaN6oQgiXJAJ3AXtJv1xfjcEJh7vOaPWTIKp8trK2kC0aKQiuNsONItlIVb2b3iO2QSqdDFgH/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
7. Select &lt;strong&gt;Dimension Attributes&lt;/strong&gt;. Click on &lt;strong&gt;Next&lt;/strong&gt; to continue…&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-skIpdR69dV64lqzZPWhJvVKc16XzDp5_G8MxkdK_OxTPNXTj03q9xSJYDhlElEGqWoyX5sPT0S4iDTh74NEryMP_zPQlGKL6JUlvBDWTRNLp5HCBPnTlrodBLhKAt7-4To8K5qXWfoPR/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;
8. Click on &lt;strong&gt;Next&lt;/strong&gt; to continue…&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGuZgtBdXrgqsBODVtoki9Ub7Nf7LODLSXbtLbqKZrL0xIvE0V_myPDVn0bSjUZsbqh3b4P5u-iYE5hjL0iN5QLHeQGADHrjg8uuQaHJrNbD92uaO9J-zDMjeiOa5_hv6WPD3H3AemgqLu/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
9. Now we are at &lt;strong&gt;Completing the Wizard&lt;/strong&gt;. Give proper dimension name click &lt;strong&gt;Finish&lt;/strong&gt; to complete. &lt;br /&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5sf2KjnaIl-6PDl-Y5pLfLzAg4IbROgQ7GSefPRVwtfskH_Z5BoQ26g1Pd0TpeQZGcIzd_zduRaua4-2hZwlJSkCNBipX1fhEg5jieGBCmebuR_xGPCcFJBVTy1CQPBQlR-IsmlyN8WdZ/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
10. Newly created dimension is now available in Dimension Usage tab.&amp;nbsp;At the intersection of &lt;strong&gt;Fact Sales&lt;/strong&gt; measure group and the &lt;strong&gt;Sales Order Number&lt;/strong&gt; dimension, click the ellipsis button (…) in the &lt;strong&gt;Item Description&lt;/strong&gt; cell to review the fact relationship properties.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRQN4QvuV2Bm0pT5oty3ZThB5jwBEbqT9_cjqgFaq8KVPbXlUEYfca3bBpbtrVL5u4sd0PvvqChHciIUGvjaoeggF9DeOwtjrfeyi-fUCu_bExHUFEvcYP9kDL_sreDNUAeNkUtNpgDccz/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Define Relationship dialog box opens. Notice that you cannot configure any of the properties. The Selected relationship type should be &lt;strong&gt;Fact&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
The following image shows the fact relationship properties in the Define Relationship dialog box&lt;br /&gt;
&lt;span style=&quot;clear: left; cssfloat: left; float: left; font-size: small; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKsE1uy670_8P6TArSu2YmoPzy6l3pV9VRwflT6XCRp6WglPQtdEJ3jusVv32ufaTl1kZ8m3vL9nL5DU7HVtWOikYV0prsy5DnKpfugadxyjlRRYoCrWK_DVpl7FlklQ507lEHu-ls-Kcd/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;border: currentColor; clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdKMET0wquspRwN5_I6-JjrHSQ_SdRGJC0lHiK6KOWZ2XVcjD9t3fWJy9S7LOC8f_6Ye4ozHSGeHL7CDH5_vFHM9uIH6L8XeiWosQOa9yk4Zia0RJEa8G9wCUyqoEhiBefDlFxJ05V6GO3/s1600/Pic1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdKMET0wquspRwN5_I6-JjrHSQ_SdRGJC0lHiK6KOWZ2XVcjD9t3fWJy9S7LOC8f_6Ye4ozHSGeHL7CDH5_vFHM9uIH6L8XeiWosQOa9yk4Zia0RJEa8G9wCUyqoEhiBefDlFxJ05V6GO3/s320/Pic1.png&quot; tt=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;border: currentColor; clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/05/creating-degenerated-dimension.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg26zJYwFwnIBCdUkzF49rsP6a62XuZ5XPsjQ9UwlFL6dVPOrxFHAlAVYdrrETAjF0elMTUtUHb-6HpkRLbCyLkjmbiNSyTt064jxiSzQiWzLPgrJojAdkynaBJDNYNH5wgRQX_ydZhDxHd/s72-c/Pic1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-8940255013039471790</guid><pubDate>Wed, 02 Nov 2011 05:23:00 +0000</pubDate><atom:updated>2012-08-21T20:12:01.900-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Cube</category><category domain="http://www.blogger.com/atom/ns#">KPI</category><category domain="http://www.blogger.com/atom/ns#">SSAS</category><title>Key Performance Indicators (KPIs) using Analysis Services</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In business terminology, a&amp;nbsp;KPI is a quantifiable measurement for gauging business success. In Analysis Services, a KPI is a collection of calculations that are associated with a measure group in a cube that are used to evaluate business success. Typically, these calculations are a combination of Multidimensional Expressions (MDX) expressions or calculated members. KPIs also have additional metadata that provides information about how client applications should display the results of the KPI&#39;s calculations &lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;strong&gt;&lt;span style=&quot;color: #073763;&quot;&gt;Common KPI Terms: &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Goal&lt;/span&gt; -&lt;/strong&gt;&amp;nbsp;An MDX numeric expression or a calculation that returns the target value of the KPI. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Value&lt;/span&gt; -&lt;/strong&gt;&amp;nbsp;An MDX numeric expression that returns the actual value of the KPI. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Status&lt;/span&gt; -&lt;/strong&gt;&amp;nbsp;An MDX expression that represents the state of the KPI at a specified point in time. The status MDX expression should return a normalized value between -1 and 1. Values equal to or less than -1 will be interpreted as &quot;bad&quot; or &quot;low.&quot; A value of zero (0) is interpreted as &quot;acceptable&quot; or &quot;medium.&quot; Values equal to or greater than 1 will be interpreted as &quot;good&quot; or &quot;high.&quot; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Trend&lt;/span&gt;&lt;/strong&gt; - An MDX expression that evaluates the value of the KPI over time. The trend can be any time-based criterion that is useful in a specific business context. The trend MDX expression enables a business user to determine whether the KPI is improving over time or degrading over time. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Status indicator&lt;/span&gt;&lt;/strong&gt; - A visual element that provides a quick indication of the status for a KPI.&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Trend indicator&lt;/span&gt;&lt;/strong&gt; - A visual element that provides a quick indication of the trend for a KPI.&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Display folder&lt;/span&gt;&lt;/strong&gt; - The folder in which the KPI will appear when a user is browsing the cube. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Parent KPI&lt;/span&gt;&lt;/strong&gt; - A reference to an existing KPI that uses the value of the child KPI as part of computation of the parent KPI. Sometimes, a single KPI will be a computation that consists of the values for other KPIs. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Weight&lt;/span&gt;&lt;/strong&gt; - An MDX numeric expression that assigns a relative importance to a KPI. If the KPI is assigned to a parent KPI, the weight is used to proportionally adjust the results of the child KPI value when calculating the value of the parent KPI. &lt;/li&gt;
&lt;/ul&gt;
&lt;strong&gt;&lt;span style=&quot;color: #073763;&quot;&gt;Creating KPIs using Business Intelligence Development Studio (BIDS)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Click on the &lt;strong&gt;&lt;em&gt;KPIs&lt;/em&gt;&lt;/strong&gt; tab &lt;/li&gt;
&lt;li&gt;We shall first add a KPI named &lt;strong&gt;&lt;em&gt;ProfitPercentage&lt;/em&gt;&lt;/strong&gt; to the cube: &lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Click on the &lt;em&gt;New KPI&lt;/em&gt; button or right-click on the KPI Organizer window and select &lt;em&gt;New KPI&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;In the KPI Designer which opens up, type in the name of the KPI as &lt;em&gt;ProfitPercentage&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Add the measure to the &lt;strong&gt;Sales Fact&lt;/strong&gt; measure group by selecting from the &lt;strong&gt;Associated measure group&lt;/strong&gt; drop down.&lt;/li&gt;
&lt;li&gt;Now let&#39;s add an expression to evaluate the value property of the KPI: &lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Type the following expression in the Value Expression box. You could also drag the measures from the Metadata tab in the Calculation tools window. &lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;color: #073763;&quot;&gt;[Measures].[Profit]/[Measures].[Product Cost]&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
OR &lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #073763;&quot;&gt;([Measures].[Sales Amount]/[Measures].[Product Cost]-1&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
We have built the expression above using the logic that ProfitPercentage is calculated as the difference in Sales and Cost, divided by the Cost.&lt;/div&gt;
&lt;div&gt;
Here [Measures].[Profit] is Calculated Member using below calculation:&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE MEMBER CURRENTCUBE&lt;/span&gt;.[MEASURES].[Profit]&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;SUM&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;(&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;[Date].[Calendar Year - Qtr - Month].&lt;span style=&quot;color: #660000;&quot;&gt;currentmember&lt;/span&gt;, &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;[Measures].[Sales Amount]-[Measures].[Product Cost]&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;), &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FORMAT_STRING&lt;/span&gt; = &lt;span style=&quot;color: #990000;&quot;&gt;&quot;#,#&quot;&lt;/span&gt;, &lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VISIBLE&lt;/span&gt; = 1;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Now, let us set the goal of the KPI to a constant. Enter 0.25 in the Goal Expression box, which means the goal expects 25% more in sales than the cost.&lt;/li&gt;
&lt;li&gt;Next we are on to the all important status. Here we shall write an expression to compare the value with the goal:&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Before examining the actual expression let us take a look at a pseudo-expression:&lt;br /&gt;
CASE&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN value/goal &amp;gt;= 0.9 THEN 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN value/goal&amp;nbsp;&amp;lt; 0.8 THEN -1 &lt;br /&gt;
&amp;nbsp;&amp;nbsp; ELSE 0 &lt;br /&gt;
END &lt;br /&gt;
&lt;br /&gt;
Here, a ratio of .9 would be considered good in this instance. This means that if the value makes up at least 90% of the &lt;em&gt;goal&lt;/em&gt; then it would be considered as successful, hence the &lt;em&gt;value&lt;/em&gt; 1 to indicate it. If &lt;em&gt;value/goal&lt;/em&gt; equals to less than 0.8 then the status will be considered as a failure (-1). And all those values do not fall into the above ranges will be considered neutral (0). &lt;br /&gt;
&lt;br /&gt;
Now, enter the following MDX expression into the &lt;em&gt;&lt;strong&gt;Status expression&lt;/strong&gt;&lt;/em&gt; box:&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CASE &lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;)/&lt;span style=&quot;color: #660000;&quot;&gt;KPIGoal&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;)&amp;gt;=.9 &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; 1&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; WHEN&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;)/&lt;span style=&quot;color: #660000;&quot;&gt;KPIGoal&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;)&amp;lt; .8 &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; -1 &lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ELSE&lt;/span&gt; 0 &lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
END&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
Being the realization of the previous &quot;pseudo-expression&quot;, the above expression replaces &lt;em&gt;value&lt;/em&gt; with &lt;em&gt;KPIValue(&quot;ProfitPercentage&quot;)&lt;/em&gt; and &lt;em&gt;goal&lt;/em&gt; with &lt;em&gt;KPIGoal(&quot;ProfitPercentage&quot;)&lt;/em&gt;. The KPIValue function returns the value of the KPI&#39;s value property, while the KPIGoal function returns the value of the KPI&#39;s goal property. Both functions take the name of the KPI through a character string parameter. &lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Select an appropriate image type from the &lt;em&gt;&lt;strong&gt;Status indicator&lt;/strong&gt;&lt;/em&gt; drop down to provide for the visuals of the KPI status.&lt;/li&gt;
&lt;li&gt;The next property to be configured is the trend. Once again, let us first look at a &quot;pseudo-expression&quot;: &lt;br /&gt;
CASE&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN IsEmpty(x) THEN 0&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN v - vX &amp;gt;= 0.25 THEN 1&lt;br /&gt;
&amp;nbsp;&amp;nbsp; WHEN v - vX &amp;lt; -0.1 THEN -1 &lt;br /&gt;
&amp;nbsp;&amp;nbsp; ELSE 0 &lt;br /&gt;
END &lt;br /&gt;
&lt;br /&gt;
Here, x is the current time period of the previous year. For instance if the current selected time period is 20-May-2008, x will be 20-May-2007. v is the value of the KPI, which by default would return the value for the current time period. vx is the value of the KPI for the same time period of the previous year. The expression first checks if x is empty, thereby resulting in 0 (or no change in trend). Then, it checks if the current period&#39;s value is an increase of at least 25%, thereby indicating 1 or a positive trend. If there&#39;s a decrease of more than 10% from last year it indicates a negative trend or -1. All other results will indicate no change in the trend (or 0). &lt;br /&gt;
&lt;br /&gt;
Enter the following MDX expression in the Trend expression textbox: &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CASE &lt;br /&gt;
WHEN&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;IsEmpty&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;ParallelPeriod&lt;/span&gt;([Date].[Calendar Year - Qtr – Month].[Calendar Year], 1,[Date].[Calendar Year - Qtr – Month].&lt;span style=&quot;color: #660000;&quot;&gt;CurrentMember&lt;/span&gt;)) &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; 0 &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;)-(&lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;&lt;span style=&quot;color: #660000;&quot;&gt;(&quot;ProfitPercentage&quot;&lt;/span&gt;), &lt;span style=&quot;color: #660000;&quot;&gt;ParallelPeriod&lt;/span&gt;([Date].[Calendar Year - Qtr - Month].[Calendar Year],1,[Date].[Calendar Year - Qtr - Month].&lt;span style=&quot;color: #660000;&quot;&gt;CurrentMember&lt;/span&gt;)) &amp;gt;= 0.25 &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; 1&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; &lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;) - &lt;span style=&quot;color: #660000;&quot;&gt;KPIValue&lt;/span&gt;(&lt;span style=&quot;color: #660000;&quot;&gt;&quot;ProfitPercentage&quot;&lt;/span&gt;), &lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;ParallelPeriod&lt;/span&gt;([Date].[Calendar Year - Qtr - Month].[Calendar &lt;br /&gt;
Year],1,[Date].[Calendar Year - Qtr - Month].&lt;span style=&quot;color: #660000;&quot;&gt;CurrentMember&lt;/span&gt;)) &amp;lt; -0.1 &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; -1 &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; 0 &lt;br /&gt;
&lt;span style=&quot;background-color: white; color: blue;&quot;&gt;END&lt;/span&gt; &lt;br /&gt;
&lt;br /&gt;
In the MDX expression above, x is replaced by ParallelPeriod([Date].[Calendar Year - Qtr - Month].[Calendar Year], 1,[Date].[Calendar Year - Qtr - Month].CurrentMember) ParallelPeriod is a function which returns a member from a prior period in the same relative position as a specified member. The variable v is replaced by KPIValue(&quot;ProfitPercentage&quot;) and vx is replaced by (KPIValue(&quot;ProfitPercentage&quot;), ParallelPeriod([Date].[Calendar Year - Qtr - Month].[Calendar Year], 1,[Date].[Calendar Year - Qtr - Month].CurrentMember)). &lt;/li&gt;
&lt;li&gt;Select an appropriate image type from the Trend indicator drop down to provide for the visual of the KPI trend. Here&#39;s a sample of what the KPI designer should look like:&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9NQ4edTneqvq4tlo3pU77Z1TS-PcmUlTVplxxksi9L99COz-FYEU4UmH2DW9PFR8m0i6Ym5_LF_LB7MhlsV5w8fNO4fE0Jhevh8Q7mmGxsh-m957uhoZ4vqdw0meoRG7zOflIFeTl0nBQ/s1600/kpi.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9NQ4edTneqvq4tlo3pU77Z1TS-PcmUlTVplxxksi9L99COz-FYEU4UmH2DW9PFR8m0i6Ym5_LF_LB7MhlsV5w8fNO4fE0Jhevh8Q7mmGxsh-m957uhoZ4vqdw0meoRG7zOflIFeTl0nBQ/s320/kpi.png&quot; tt=&quot;true&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
The KPIs is done! Next, process the cube. You will be able to view the KPIs using the built-in KPI Browser under the KPIs tab in BIDS. You could also use Office 2007 Excel.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhVBD8cqCLsUTk0RHXEGRIwQh-RpDZQM1ZOJby3pC-aMRzK_d_FV-D75WlKVwo69Y3BKkyfFWXPh00AtAFVg0RXpRS7kcV3GzbifTHhwYBc_xqgvDEOGROep-SXXsTzAEiJqWdiHiu_xbL/s1600/kpi.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhVBD8cqCLsUTk0RHXEGRIwQh-RpDZQM1ZOJby3pC-aMRzK_d_FV-D75WlKVwo69Y3BKkyfFWXPh00AtAFVg0RXpRS7kcV3GzbifTHhwYBc_xqgvDEOGROep-SXXsTzAEiJqWdiHiu_xbL/s320/kpi.png&quot; tt=&quot;true&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/05/key-performance-indicators-kpis-using.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9NQ4edTneqvq4tlo3pU77Z1TS-PcmUlTVplxxksi9L99COz-FYEU4UmH2DW9PFR8m0i6Ym5_LF_LB7MhlsV5w8fNO4fE0Jhevh8Q7mmGxsh-m957uhoZ4vqdw0meoRG7zOflIFeTl0nBQ/s72-c/kpi.png" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-7916838270251822820</guid><pubDate>Sat, 01 Oct 2011 23:11:00 +0000</pubDate><atom:updated>2012-08-21T20:10:32.806-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Cube</category><category domain="http://www.blogger.com/atom/ns#">Date Dimension</category><category domain="http://www.blogger.com/atom/ns#">SSAS</category><title>Sort Dimension Members in DESCending order</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Sometimes we need to display Date dimension members in descending order. For example, Client ask to show &lt;strong&gt;Calendar Year&lt;/strong&gt; in DESC order.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
But Analysis Services doesn&#39;t provide a way to sort dimension members in Descending order. SSAS provides only Ascending order.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
However, we can achieve this sort functionality&amp;nbsp;by using a simple &lt;strong&gt;trick&lt;/strong&gt;. I will take an example to display Calendar Year member in DESC order. Below are the steps to achieve our goal:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;strong&gt;Step1&lt;/strong&gt;: Go to &lt;strong&gt;Data Source View &lt;/strong&gt;(DSV)&amp;nbsp;and right click on &lt;em&gt;Date&lt;/em&gt; dimension in DSV diagram. Click on &lt;em&gt;New Named Calculation...&lt;/em&gt; to create a new member.&lt;br /&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPs9D3nngeZRXvaTvywu6WqNcjHn1vIZhkEDWDQ216aa5BdWSdNNrzn0myzfjcG7KYDClhnMXUTD9YXaZFLW1apAakKUD2P719sttcKMJZxAaCWn4rvngHNSbAHi-QYvTi7SMyCxmNpAwf/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPs9D3nngeZRXvaTvywu6WqNcjHn1vIZhkEDWDQ216aa5BdWSdNNrzn0myzfjcG7KYDClhnMXUTD9YXaZFLW1apAakKUD2P719sttcKMJZxAaCWn4rvngHNSbAHi-QYvTi7SMyCxmNpAwf/s320/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Step2: Now enter &lt;strong&gt;CalendarYearSort&lt;/strong&gt; in &lt;em&gt;Column name &lt;/em&gt;and &lt;strong&gt;&lt;span style=&quot;font-family: Times, &amp;quot;Times New Roman&amp;quot;, serif;&quot;&gt;0-CalendarYear&lt;/span&gt;&lt;/strong&gt; in &lt;em&gt;Expression&lt;/em&gt; textbox.&amp;nbsp;This additional column will be used to sort calendar year in descending order. Click OK to proceed. Here I considered that CalendarYear is existing column in the dimension.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrd1oHtvAWvaM6RoW020t0zw_wru3tmpBVms0GkDG84XTMRRfWm9HdxfbE9cVOq2c0Ef3IjXMwTAO8_dvrQLEfqdcEZ95EUL2THLDUjtLTSUNTLTdBY5rynNv9hKZL8cXfI2qBnMbtBJlK/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; height=&quot;233&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrd1oHtvAWvaM6RoW020t0zw_wru3tmpBVms0GkDG84XTMRRfWm9HdxfbE9cVOq2c0Ef3IjXMwTAO8_dvrQLEfqdcEZ95EUL2THLDUjtLTSUNTLTdBY5rynNv9hKZL8cXfI2qBnMbtBJlK/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;Step3: Go to &lt;em&gt;Dimension Structure&lt;/em&gt; of Date dimension and drag and drop new member &quot;CalendarYearSort&quot; in attributes list.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Step4: Click on &lt;strong&gt;Attributes Relationship&lt;/strong&gt; tab. Right click on &lt;strong&gt;Calendar Year&lt;/strong&gt; member and select &lt;em&gt;New Attribute Relationship...&lt;/em&gt; It will open &lt;strong&gt;Create Attribute Relationship&lt;/strong&gt; wizard.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ1QE_4oEuL_jxxm8jtSM2c1769Ao0IISrNESzVREp5m1zzwzd6M484t_7PpafX3q-TjeGOQ1bmYyMbfXVO9LDmXfkrEIx_ImPHc4tVyPtLUuX8hc5gmR_pvpKb-jNKTHQVuOwAaNqDnzi/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; height=&quot;241&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ1QE_4oEuL_jxxm8jtSM2c1769Ao0IISrNESzVREp5m1zzwzd6M484t_7PpafX3q-TjeGOQ1bmYyMbfXVO9LDmXfkrEIx_ImPHc4tVyPtLUuX8hc5gmR_pvpKb-jNKTHQVuOwAaNqDnzi/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;Step5: In &lt;strong&gt;Create Attribute Relationship&lt;/strong&gt;, select Related Attribute as &lt;strong&gt;Calendar Year Sort&lt;/strong&gt; and Relationship type as &lt;strong&gt;Rigid&lt;/strong&gt;. Click OK to proceed.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Step6: Again go back to &lt;em&gt;Dimension Structure&lt;/em&gt; tab and click on &lt;strong&gt;Calendar Year&lt;/strong&gt; attribute. Go to properties and set following things as shown below: &lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;strong&gt;OrderBy&lt;/strong&gt;: AttributeKey and &lt;strong&gt;OrderByAttribute&lt;/strong&gt;: CalendarYearSort&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhkSCcflII_8JXfWbaUzXINPo5fRjF9d18tQlrVuhkr7wXrhzrvcJW2lJXgx8O11HcYFRRg3sEi5sZLFolw1zEZTByllbjWQgc3BZQ5CKhOR7bOOnNe76d7p-RJXt8qyB8maK5iQ2x6Dh6/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhkSCcflII_8JXfWbaUzXINPo5fRjF9d18tQlrVuhkr7wXrhzrvcJW2lJXgx8O11HcYFRRg3sEi5sZLFolw1zEZTByllbjWQgc3BZQ5CKhOR7bOOnNe76d7p-RJXt8qyB8maK5iQ2x6Dh6/s320/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Step7: Now Calendar Year is set in decending order. Just save and process the cube.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Note: Before processing the cube, you can set &lt;strong&gt;AttributeHierarchyVisible = FALSE&lt;/strong&gt;&amp;nbsp;because we should not show this attribute in cube and &lt;strong&gt;AttributeHierarchyEnabled&lt;/strong&gt; = &lt;strong&gt;False &lt;/strong&gt;to reduce&amp;nbsp;cube space and increase the performance.&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/05/sort-dimension-members-in-descending.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPs9D3nngeZRXvaTvywu6WqNcjHn1vIZhkEDWDQ216aa5BdWSdNNrzn0myzfjcG7KYDClhnMXUTD9YXaZFLW1apAakKUD2P719sttcKMJZxAaCWn4rvngHNSbAHi-QYvTi7SMyCxmNpAwf/s72-c/1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-8551219769173981356</guid><pubDate>Sun, 04 Sep 2011 03:40:00 +0000</pubDate><atom:updated>2012-08-21T20:03:54.372-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>Incremental Load in SSIS</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;Problem Description&lt;/strong&gt;: Perform Incremental Load&amp;nbsp;using SSIS package. There is&amp;nbsp;one Source table with ID (may be Primary Key), CreatedDate and ModifiedDate along with other&amp;nbsp;columns. The requirement is to load the destination table with new records and update the existing records (if any updated records are available). &lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;strong&gt;Soultion&lt;/strong&gt;: &lt;br /&gt;
You can use &lt;strong&gt;Lookup Transformation&lt;/strong&gt; where you compare source and destination data based on some id/code and get the new and updated records, and then use &lt;strong&gt;Conditoional Split &lt;/strong&gt;to select the new and updated rows before loading the table.&lt;br /&gt;
&lt;br /&gt;
However, I don&#39;t recommend this approach, specially when destination table is very huge and volume of delta is very high.&lt;br /&gt;
&lt;br /&gt;
You can do it in simple steps:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Find the Maximum ID &amp;amp; Last ModifiedDate from destination and store in package variables.&lt;/li&gt;
&lt;li&gt;Pull the new and updated&amp;nbsp;records from source and load to a staging table using above variables.&lt;/li&gt;
&lt;li&gt;Insert and Update the records using Execute SQL Task&lt;/li&gt;
&lt;/ol&gt;
Here is the an step-by-step example to do this:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
STEP1: &lt;br /&gt;
Create a new Package IncrementalLoad.dtsx and add following package variables:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcAlpmN91Z2-ulr7j_czxNKJuwnzB8Pos129G726bYerQQeidFHGetX6rqdvalFTfqo8jPexaelWzl4vXy5CDChxmicg7NUM6Cx24SOybdcoYKjrHngGKz-dwbTHZ6j5l6v4JH5C26dwz/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;121&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcAlpmN91Z2-ulr7j_czxNKJuwnzB8Pos129G726bYerQQeidFHGetX6rqdvalFTfqo8jPexaelWzl4vXy5CDChxmicg7NUM6Cx24SOybdcoYKjrHngGKz-dwbTHZ6j5l6v4JH5C26dwz/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;VariableName&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Examle&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DestinationConnStr&lt;/td&gt;
&lt;td&gt;Connection string for &lt;br /&gt;destination server/db&lt;/td&gt;
&lt;td&gt;Data Source=(local);&lt;br /&gt;Initial 
Catalog=TestHN;&lt;br /&gt;Provider=SQLNCLI10.1;&lt;br /&gt;Integrated Security=SSPI;&lt;br /&gt;Auto 
Translate=False;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MaxID&lt;/td&gt;
&lt;td&gt;Max ID from&lt;br /&gt;destination table&lt;/td&gt;
&lt;td&gt;100&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MaxModifiedDate&lt;/td&gt;
&lt;td&gt;Max Date from&lt;br /&gt;destination table&lt;/td&gt;
&lt;td&gt;2010:11:10 11:50:20.003&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SourceConnStr&lt;/td&gt;
&lt;td&gt;Connection string for &lt;br /&gt;source server/db&lt;/td&gt;
&lt;td&gt;Data Source=(local);&lt;br /&gt;Initial 
Catalog=TestHN;&lt;br /&gt;Provider=SQLNCLI10.1;&lt;br /&gt;Integrated Security=SSPI;&lt;br /&gt;Auto 
Translate=False;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;
﻿&lt;/div&gt;
&lt;br /&gt;
STEP2:&lt;br /&gt;
Create Source, Destination, and staging tables using below code:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;-- Source Table (create in source DB)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;&#39;dbo.TestSource&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;U&#39;&lt;/span&gt;) &lt;span style=&quot;color: #999999;&quot;&gt;IS NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP TABLE&lt;/span&gt; dbo.TestSource&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE Table &lt;/span&gt;dbo.TestSource&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; [ID] [int] &lt;span style=&quot;color: blue;&quot;&gt;IDENTITY&lt;/span&gt;(1,1)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Code] [varchar](10)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Description]&amp;nbsp; [varchar](100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[CreatedDate]&amp;nbsp; [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[ModifiedDate] [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;default&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;-- Destination Table (create in destination DB)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;&#39;dbo.TestDestination&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;U&#39;&lt;/span&gt;) &lt;span style=&quot;color: #999999;&quot;&gt;IS NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP TABLE&lt;/span&gt; dbo.TestDestination&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE Table &lt;/span&gt;dbo.TestDestination&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; [ID] [int]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Code] [varchar](10)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Description]&amp;nbsp; [varchar](100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[CreatedDate]&amp;nbsp; [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[ModifiedDate] [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d;&quot;&gt;-- Staging Table (create in destination DB)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;OBJECT_ID&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;&#39;dbo.TestDestinationSTG&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;U&#39;&lt;/span&gt;) &lt;span style=&quot;color: #999999;&quot;&gt;IS NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;DROP TABLE&lt;/span&gt; dbo.TestDestinationSTG&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE Table &lt;/span&gt;dbo.TestDestinationSTG&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; [ID] [int]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Code] [varchar](10)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[Description] [varchar](100)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[CreatedDate] [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; ,[ModifiedDate] [datetime] &lt;span style=&quot;color: #999999;&quot;&gt;NOT NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
STEP3: &lt;br /&gt;
Create two OLE DB Connection Manager, one for Source Server and another for Destination Server.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhItE9CRI9R3DqyOgJUKGMGfGbr4YSfVyH6qeYuC5d3hkd8alIk1vdY83v8Qi823mnMVT_6FM7l7aTthIXZ9N99_m4bK08obEo7qhPD-Y_22Gd4wTtPQRAqRnnxPsxc1ZLXjOIRM_Q8n-PK/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhItE9CRI9R3DqyOgJUKGMGfGbr4YSfVyH6qeYuC5d3hkd8alIk1vdY83v8Qi823mnMVT_6FM7l7aTthIXZ9N99_m4bK08obEo7qhPD-Y_22Gd4wTtPQRAqRnnxPsxc1ZLXjOIRM_Q8n-PK/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
In the connection manager properties, set the expression &lt;strong&gt;ConnectionString&lt;/strong&gt; with respective variables as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKnvlLpL7FCAOu8hiDWPrCx9J4HCQ3QeCSCvufVDviJyV1kdOPbn_MvTZRBJov0z6pBzPmVLCg108YVBxuETflMfOulOa8fp6_LACuiDbNg-yXBdTXNwSzXPyU8GgKJ7GftE5F-hZ3YfMV/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;177&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKnvlLpL7FCAOu8hiDWPrCx9J4HCQ3QeCSCvufVDviJyV1kdOPbn_MvTZRBJov0z6pBzPmVLCg108YVBxuETflMfOulOa8fp6_LACuiDbNg-yXBdTXNwSzXPyU8GgKJ7GftE5F-hZ3YfMV/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
STEP4:&lt;br /&gt;
Drag and drop Execute SQL Task&amp;nbsp;and name it -&lt;br /&gt;
&lt;strong&gt;Execute SQL Task - Get Max ID and Last ModifiedDate&lt;/strong&gt;.&lt;br /&gt;
Double click on EST and set&amp;nbsp; following properties:&lt;br /&gt;
ResultSet = &lt;strong&gt;Single row&lt;/strong&gt;&lt;br /&gt;
Connection = &lt;strong&gt;Destination Server&lt;/strong&gt;&lt;br /&gt;
SQLStatement =&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;SELECT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;ISNULL&lt;/span&gt;(&lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;(ID) ,0) MaxID,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;ISNULL&lt;/span&gt;(&lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;(ModifiedDate),&lt;span style=&quot;color: red;&quot;&gt;&#39;2000-01-01&#39;&lt;/span&gt;) MaxModifiedDate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestDestination (&lt;span style=&quot;color: blue;&quot;&gt;NOLOCK&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Drag and drop another Execute SQL Task to Truncate staging table. Rename the task - &lt;strong&gt;Execute SQL Task - Truncate staging Table &lt;/strong&gt;and set following properties:&lt;br /&gt;
ResultSet = &lt;strong&gt;None&lt;/strong&gt;&lt;br /&gt;
Connection = &lt;strong&gt;Destination Server&lt;/strong&gt;&lt;br /&gt;
SQLStatement = &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;Truncate Table &lt;/span&gt;dbo.TestDestinationStg&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Drag and drop Data Flow Task and name it &lt;strong&gt;Data Flow Task - Pull New and Updated rows&lt;/strong&gt;. &lt;br /&gt;
Double click on DFT or click on Data Flow tab. &lt;br /&gt;
Now drag and drop OLE DB Source and select &lt;strong&gt;Source Server&lt;/strong&gt; in &lt;em&gt;OLE DB connection manager&lt;/em&gt;, select &lt;strong&gt;SQL command&lt;/strong&gt; in &lt;em&gt;Data access mode&lt;/em&gt;, and write following T-SQL code in SQL command text: &lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;[ID],[Code],[Description],&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;[CreatedDate],[ModifiedDate]&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestSource&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; [ID] &amp;gt; ? OR [ModifiedDate] &amp;gt;= ?&lt;/span&gt; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Click on Columns to generate metadata and set &lt;strong&gt;Parameters&lt;/strong&gt; for above query: &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqwA7Rj77SLXF25pa6PdrkFZAus1babEKw25iK9EIgOgT-F696GSUFECpPGC1J6WuYUmXXuvFSEDUpsedWlqmIoacEmpqkGkKjwodPIlj21UGziUCzETJMsI4gSYS68DAtyMiC7QhJ2PeR/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;173&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqwA7Rj77SLXF25pa6PdrkFZAus1babEKw25iK9EIgOgT-F696GSUFECpPGC1J6WuYUmXXuvFSEDUpsedWlqmIoacEmpqkGkKjwodPIlj21UGziUCzETJMsI4gSYS68DAtyMiC7QhJ2PeR/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now drag and drop OLE DB Destination task and select &lt;strong&gt;Destination Server&lt;/strong&gt; in &lt;em&gt;OLE DB Connection manager&lt;/em&gt;, &lt;strong&gt;Table or view - fast load &lt;/strong&gt;in &lt;em&gt;Data access mode&lt;/em&gt;, and &lt;strong&gt;dbo.TestDestinationSTG&lt;/strong&gt; in &lt;em&gt;Name of the table or view&lt;/em&gt;.&lt;br /&gt;
Now click on Mapping to map the metadat with source columns.&lt;br /&gt;
&lt;br /&gt;
Drag and drop one more Execute SQL Task and rename it to &lt;strong&gt;Execute SQL Task - Insert and Updated new rows &lt;/strong&gt;and set following properties:&lt;br /&gt;
ResultSet = &lt;strong&gt;None&lt;/strong&gt;&lt;br /&gt;
Connection = &lt;strong&gt;Destination Server&lt;/strong&gt;&lt;br /&gt;
SQLStatement =&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;-- INSERT New Records&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO &lt;/span&gt;TestDestination&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;([ID],[Code],[Description],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;[CreatedDate],[ModifiedDate])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[ID],[Code],[Description],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; [CreatedDate],[ModifiedDate]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestDestinationStg &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; ID &amp;gt; ?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;--UPDATE modified records&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt; D &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; D.[ID] = S.[ID]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;,D.[Code] = S.[Code]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;,D.[Description] = S.[Description]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;,D.[CreatedDate] = S.[CreatedDate]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;,D.[ModifiedDate] = S.[ModifiedDate]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestDestination D&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: #999999;&quot;&gt;JOIN&lt;/span&gt; TestDestinationStg S&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; ON&lt;/span&gt; S.ID = D.ID &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; S.ID &amp;lt;= ? AND &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; S.ModifiedDate &amp;gt; D.ModifiedDate&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Click on Parameter Mapping and set the parameters as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7nR85HR0INCi-dms81IP8L7GvZq73b_lO-vBlNUsTuQQTVvJIR92pBKnts6tyiCaZYjzA0Ugio9L5axqFwMCMc3JL77ArVwBLRn1twkmBUvHlkMzNvA6h2aa43sG4sQkvY9fOrxSqG2Tl/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;51&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7nR85HR0INCi-dms81IP8L7GvZq73b_lO-vBlNUsTuQQTVvJIR92pBKnts6tyiCaZYjzA0Ugio9L5axqFwMCMc3JL77ArVwBLRn1twkmBUvHlkMzNvA6h2aa43sG4sQkvY9fOrxSqG2Tl/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Finally package will look like below snapshot:&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYr0Zqy39zF6IYk5S00avSXivYVczFwNBT94BSLqPx3OGcwec5vhczVrNbdaV76yn_Rn7T3X0fQ2RZdEp4MU2ab4rPLVJvvXDgcYx8VG622YYEBRPyj4AwU6JGsLxZocQ5LPT5MwQ6Sjoc/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;229&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYr0Zqy39zF6IYk5S00avSXivYVczFwNBT94BSLqPx3OGcwec5vhczVrNbdaV76yn_Rn7T3X0fQ2RZdEp4MU2ab4rPLVJvvXDgcYx8VG622YYEBRPyj4AwU6JGsLxZocQ5LPT5MwQ6Sjoc/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
STEP5: &lt;br /&gt;
We are done with package development. Its time to test the package. I will test this package in three steps:&lt;br /&gt;
1. Insert few dummy records in Source table while keeping Destination table&amp;nbsp;empty.&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;--CASE 1: First Time Execution&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO &lt;/span&gt;dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt; (&lt;span style=&quot;color: red;&quot;&gt;&#39;AAA&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;American Automobile Association&#39;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WAITFOR DELAY &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;00:00:01.100&#39;&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;-- delay between two rows&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO &lt;/span&gt;dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt; (&lt;span style=&quot;color: red;&quot;&gt;&#39;ABC&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;Associated Builders &amp;amp; Contractors&#39;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WAITFOR DELAY &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;00:00:01.150&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO&lt;/span&gt; dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt; (&lt;span style=&quot;color: red;&quot;&gt;&#39;RR&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;Road Runner&#39;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-iF4BmnP9UECRE-vJOuMp_k6PJRcHUnARS9ZL9G5NZmyUoEgv00Fgm5ZzzfGgbeoJpsvod7jYu9Z8HbilEIu5ptLybinZ1hyqJ8Z8_5s_n-cvBFA3-4B4MGtOblEf7mT_bh7aGMEoGm18/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;82&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-iF4BmnP9UECRE-vJOuMp_k6PJRcHUnARS9ZL9G5NZmyUoEgv00Fgm5ZzzfGgbeoJpsvod7jYu9Z8HbilEIu5ptLybinZ1hyqJ8Z8_5s_n-cvBFA3-4B4MGtOblEf7mT_bh7aGMEoGm18/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
Now execute the package and check the destination data. You can add &lt;strong&gt;Data viewers&lt;/strong&gt; in Data Flow&amp;nbsp;to see the result at run time as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0HMbFdROxhrFRQCnHkH0EYY7Y17RafSsD2SLXXqRZGdLatk9k10NCuZJWBH0TH2WjDgxL_TTRkkk3ZLF44cCwA08ULW39adUuCVG3UJ0GEjvxqFYUJWShBEQkg0Z7AtPvCiUxSoV3576O/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;126&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0HMbFdROxhrFRQCnHkH0EYY7Y17RafSsD2SLXXqRZGdLatk9k10NCuZJWBH0TH2WjDgxL_TTRkkk3ZLF44cCwA08ULW39adUuCVG3UJ0GEjvxqFYUJWShBEQkg0Z7AtPvCiUxSoV3576O/s320/2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
2. Insert few more records in Source table to check whether new records are inserted into Destination table.&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;--CASE 2: Only New Records&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO&lt;/span&gt; dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt; (&lt;span style=&quot;color: red;&quot;&gt;&#39;TSL&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;Trina Solar Limited&#39;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WAITFOR DELAY&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;00:00:01&#39; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;-- delay between two rows&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO &lt;/span&gt;dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt;&amp;nbsp;(&#39;FSLR&#39;,&#39;First Solar, Inc.&#39;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now execute the package and check for new records:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5uZIH2smh8d2Qs95L0-26PBVDJYE6qa39PVVDpqrc-QJ88ReRdfteEUspt4FElXMUVy8IWOXSS4QkTzuSs72CGYTas2zkWM1Y6tYefBrhT605tghUsI0QZxGMVNkF22OdLlQUEABc7tz/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;120&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5uZIH2smh8d2Qs95L0-26PBVDJYE6qa39PVVDpqrc-QJ88ReRdfteEUspt4FElXMUVy8IWOXSS4QkTzuSs72CGYTas2zkWM1Y6tYefBrhT605tghUsI0QZxGMVNkF22OdLlQUEABc7tz/s320/3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
3. Insert few more records and update few existing records in Source table and check whether both table are in sync.&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;--CASE 3 -- New &amp;amp; Updated Records&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO&lt;/span&gt; dbo.TestSource ([Code],[Description])&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES&lt;/span&gt; (&lt;span style=&quot;color: red;&quot;&gt;&#39;LDK&#39;&lt;/span&gt;,&lt;span style=&quot;color: red;&quot;&gt;&#39;LDK Solar Co., Ltd&#39;&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt; dbo.TestSource &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; [Description] = &lt;span style=&quot;color: red;&quot;&gt;&#39;Associated Builders and Contractors&#39;&lt;/span&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;ModifiedDate = &lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; [Code] = &lt;span style=&quot;color: red;&quot;&gt;&#39;ABC&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Finaly check source and destination tables for match. Since I have both Source &amp;amp; Destination tables in one server, I can use &lt;span style=&quot;color: blue;&quot;&gt;EXCEPT&lt;/span&gt; command (for this example) which retunrs no records i.e. both the tables are in sync.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp6SSlYWg44l6t_Ls71MZZAKHdO-wSmMAQ4ALVhpZCYpowQHIhEsHudSWcLJV3icLhhTJ9U5_qHAI1pQwmsnKXL3lcwR_IBbNL9ilcLiRC9t6WJ5aWyJR6ee8T8dGjJiaY_T_qdQMP3mGR/s1600/4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;157&quot; px=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp6SSlYWg44l6t_Ls71MZZAKHdO-wSmMAQ4ALVhpZCYpowQHIhEsHudSWcLJV3icLhhTJ9U5_qHAI1pQwmsnKXL3lcwR_IBbNL9ilcLiRC9t6WJ5aWyJR6ee8T8dGjJiaY_T_qdQMP3mGR/s320/4.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Cheers!!!&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/11/incremental-load-using-ssis-package.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpcAlpmN91Z2-ulr7j_czxNKJuwnzB8Pos129G726bYerQQeidFHGetX6rqdvalFTfqo8jPexaelWzl4vXy5CDChxmicg7NUM6Cx24SOybdcoYKjrHngGKz-dwbTHZ6j5l6v4JH5C26dwz/s72-c/1.png" height="72" width="72"/><thr:total>21</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-1956705014879784249</guid><pubDate>Mon, 01 Aug 2011 23:18:00 +0000</pubDate><atom:updated>2012-08-21T20:00:10.994-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SharePoint List Source</category><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>Pulling SharePoint List using SSIS 2008</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Do you want to pull SharePoint List data into SQL database using SSIS? If your answer is Yes then you can go for SharePoint List Source. You can download the setup from Microsoft SQL Server Community Sample: Integration Services: here is the link: &lt;a href=&quot;http://sqlsrvintegrationsrv.codeplex.com/releases/view/17652&quot;&gt;&lt;strong&gt;SharePointListAdaptersSetup&lt;/strong&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This component has two controls - &lt;u&gt;SharePoint List Source&lt;/u&gt; and &lt;u&gt;SharePoint List Destination&lt;/u&gt;. The Specific Features of the included SSIS Components are:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;SharePoint Source Component&lt;/strong&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Auto-detects all of the public fields from a SharePoint List or view of the list.&lt;/li&gt;
&lt;li&gt;Supports removal of fields from the output flow, which optimizes the query against SharePoint for increased performance.&lt;/li&gt;
&lt;li&gt;Supports restricting SharePoint data by a custom CAML query, which can be provided through a variable expression for fine tuned filtering over large lists.&lt;/li&gt;
&lt;li&gt;Provides a tuning feature for the # of rows to return at a time. Often with SharePoint, large lists need to be brought over in smaller batches than wide (many field) lists, or else the Webservice will die.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;strong&gt;SharePoint Destination Component&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Auto-detects all of the editable fields from a SharePoint List&lt;/li&gt;
&lt;li&gt;Only fields bound to columns from the input flow will be ‘updated’, for performance.&lt;/li&gt;
&lt;li&gt;Supports deleting rows by ID&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;strong&gt;System&amp;nbsp;Requirements&lt;/strong&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;.Net 3.5 Framework &lt;/li&gt;
&lt;li&gt;SQL Server Integration Services 2008&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;strong&gt;&amp;nbsp;How to Use&lt;/strong&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Download the sample from &lt;strong&gt;&lt;a href=&quot;http://sqlsrvintegrationsrv.codeplex.com/releases/view/17652&quot;&gt;SharePointListAdaptersSetup&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Run&amp;nbsp;&lt;strong&gt;SharePointListAdaptersSetup.msi&lt;/strong&gt; to install the SSIS component. This installer places pre-built binaries into the Global Assembly Cache (GAC) and into the C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents directory (if present).&lt;/li&gt;
&lt;li&gt;A good way to explore the sample is to try using it, understand its behavior, and then begin reviewing the source code for the component. If you do not see the SharePoint adapters in your toolbox automatically, then follow these instructions:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;em&gt;Business Intelligence Development Studio&lt;/em&gt;, open a package, and then click &lt;strong&gt;Choose Toolbox Items&lt;/strong&gt; on the &lt;strong&gt;Tools &lt;/strong&gt;menu.&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;Choose Toolbox Items&lt;/strong&gt; dialog box, click the &lt;strong&gt;SSIS Data Flow Items&lt;/strong&gt; tab, and then check &lt;strong&gt;SharePoint Destination&lt;/strong&gt; and &lt;strong&gt;SharePoint Source&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click Ok.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;The SharePoint source and destination components should now appear in the toolbox for the data flow task. You can add the source and destination components to the data flow of the package.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/08/pulling-sharepoint-list-using-ssis-2008.html</link><author>noreply@blogger.com (Hari Sharma)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-2273344184095242246</guid><pubDate>Wed, 06 Jul 2011 04:02:00 +0000</pubDate><atom:updated>2012-08-21T20:18:13.893-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Table Partition</category><title>Table Partition</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;Table partitioning&lt;/span&gt;&lt;/strong&gt; is a data organization scheme in which table data is divided across multiple&amp;nbsp;data partitions or ranges according to values in&amp;nbsp;a table column.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;Benefits of table partitioning&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
There are numerous benefits of table partitioning: &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;To improve the scalability and manageability of large tables and tables in Database and Data Warehouse&lt;/li&gt;
&lt;li&gt;Database and&amp;nbsp;Data Warehouse that would benefit from easier roll-in and roll-out of table data &lt;/li&gt;
&lt;li&gt;Furthermore, if a large table exists on a system with multiple CPUs, partitioning the table can lead to better performance through parallel operations.&lt;/li&gt;
&lt;li&gt;A&amp;nbsp;table with varying access patterns might be a concern for performance and availability when different sets of rows within the table have different usage patterns.&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp;The steps for creating a partitioned table&amp;nbsp;include the following: &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a partition function to specify how a table or index that uses the function can be partitioned.&lt;/li&gt;
&lt;li&gt;Create a partition scheme to specify the placement of the partitions of a partition function on filegroups.&lt;/li&gt;
&lt;li&gt;Create a table or index using the partition scheme. &lt;/li&gt;
&lt;/ol&gt;
&amp;nbsp; &lt;br /&gt;
Below are the steps to creation Horizontal Table Partition &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;-- Create the partition function&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE PARTITION FUNCTION&lt;/span&gt; PartitionFunctionMonthly (&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;AS RANGE RIGHT &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FOR VALUES &lt;/span&gt;(20100101, 20100201, 20100301)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;-- Add the partition scheme&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE PARTITION SCHEME&lt;/span&gt; PartitionSchemaMonthly&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;AS PARTITION&lt;/span&gt; PartitionFunctionMonthly&lt;br /&gt;
&lt;span style=&quot;color: #666666;&quot;&gt;ALL&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TO &lt;/span&gt;( [PRIMARY] )&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&amp;nbsp;&lt;span style=&quot;color: #274e13;&quot;&gt;-- Create a simple table&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE TABLE&lt;/span&gt; PartitionTable (&lt;br /&gt;
&amp;nbsp;&amp;nbsp; DateKey &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;NOT NULL&lt;/span&gt;, &lt;br /&gt;
&amp;nbsp;&amp;nbsp; CustomerKey &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;NOT NULL&lt;/span&gt;, &lt;br /&gt;
&amp;nbsp;&amp;nbsp; SalesAmt &lt;span style=&quot;color: blue;&quot;&gt;money&lt;/span&gt;,&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CONSTRAINT &lt;/span&gt;PKPartitionTable &lt;span style=&quot;color: blue;&quot;&gt;PRIMARY KEY NONCLUSTERED&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; (DateKey, CustomerKey)&lt;br /&gt;
)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; PartitionSchemaMonthly(DateKey) &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;-- Unit Testing of Partitions&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;-- Add some rows&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO&lt;/span&gt; PartitionTable (DateKey, CustomerKey, SalesAmt)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 20091201, 1, 5000 &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;ALL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 20100101, 2, 3000 &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;ALL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 20100215, 7, 6000 &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;ALL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 20100331, 5, 3000 &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt; &lt;span style=&quot;color: #666666;&quot;&gt;ALL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 20100415, 8, 6000 &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;-- A query accesses the entire table, exactly as you&#39;d expect.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;span style=&quot;color: black;&quot;&gt;*&lt;/span&gt; FROM&lt;/span&gt; PartitionTable&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #274e13;&quot;&gt;--Query partition contents&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;br /&gt;
$partition.PartitionFunctionMonthly(DateKey) &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Partition#],&lt;br /&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;(*) &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; RowCount, &lt;br /&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;Min&lt;/span&gt;(DateKey) &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; MinDate, &lt;br /&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;Max&lt;/span&gt;(DateKey) &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; MaxDate&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; PartitionTable &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GROUP BY&lt;/span&gt; $partition.PartitionFunctionMonthly(DateKey)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER BY&lt;/span&gt; [Partition#]&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/05/table-partition.html</link><author>noreply@blogger.com (Hari Sharma)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-3657492875799826865</guid><pubDate>Sun, 05 Jun 2011 03:40:00 +0000</pubDate><atom:updated>2012-08-21T20:20:21.178-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Moving Database Files From One Drive to Another</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In practice, database files grows everyday.&amp;nbsp;Sometimes it occupy the complete disk and we may end up in unsufficeint mamroy - leading to unexpected results.&lt;br /&gt;
&lt;br /&gt;
In this blog, I&#39;ll explain how to transfer&amp;nbsp;database files from one drive to another.&amp;nbsp;To explain, I&#39;ll create a test database &lt;strong&gt;TestDB&lt;/strong&gt;.&amp;nbsp;Here is the command:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE&lt;/span&gt; [master]&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;IF&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;DB_ID&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;N&#39;TestDB&#39;&lt;/span&gt;) &lt;span style=&quot;color: #666666;&quot;&gt;IS NULL&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;CREATE DATABASE&lt;/span&gt; [TestDB] &lt;span style=&quot;color: blue;&quot;&gt;ON PRIMARY&lt;/span&gt; &lt;br /&gt;
(&lt;br /&gt;
&amp;nbsp;&amp;nbsp; NAME = &lt;span style=&quot;color: red;&quot;&gt;N&#39;TestDB&#39;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,&lt;span style=&quot;color: blue;&quot;&gt;FILENAME&lt;/span&gt; = &lt;span style=&quot;color: red;&quot;&gt;N&#39;C:\MSSQL\Data\TestDB.mdf&#39;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,SIZE = 3MB&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,MAXSIZE = 2048GB&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,FILEGROWTH = 1024KB&lt;br /&gt;
)&lt;br /&gt;
&lt;span style=&quot;color: magenta;&quot;&gt;LOG&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt; &lt;br /&gt;
(&lt;br /&gt;
&amp;nbsp;&amp;nbsp; NAME = &lt;span style=&quot;color: red;&quot;&gt;N&#39;TestDB_log&#39;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,&lt;span style=&quot;color: blue;&quot;&gt;FILENAME&lt;/span&gt; = &lt;span style=&quot;color: red;&quot;&gt;N&#39;C:\MSSQL\Data\TestDB.ldf&#39;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,SIZE = 3MB&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,MAXSIZE = 2048GB&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,FILEGROWTH = 10%&lt;br /&gt;
)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;Now check existing files location:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE &lt;/span&gt;TestDB&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; name, physical_name, state_desc &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; TestDB.&lt;span style=&quot;color: #38761d;&quot;&gt;sys.master_files &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; database_id = &lt;span style=&quot;color: magenta;&quot;&gt;DB_ID&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;N&#39;TestDB&#39;&lt;/span&gt;)&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikRKsEE5lbmN33RZ7I47rfPe8NBsarOlOlUbT_o5X_VYbdHLAgSYT5DavpzBvOG7qg6aBHjOGbI7ozHThZRGlMdgpH53YtXUPu7UJQCaxSwC5HTtXkFoq-0bQEiV5uTzIZoDM-RU8xnPiW/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; gu=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikRKsEE5lbmN33RZ7I47rfPe8NBsarOlOlUbT_o5X_VYbdHLAgSYT5DavpzBvOG7qg6aBHjOGbI7ozHThZRGlMdgpH53YtXUPu7UJQCaxSwC5HTtXkFoq-0bQEiV5uTzIZoDM-RU8xnPiW/s320/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Now&amp;nbsp;the database is created, you can create some tables and enter some data into the database, if you wish, Otherwise proceed like this: &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;strong&gt;Step1: Make the database OFFLINE.&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;USE &lt;/span&gt;[master]&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ALTER DATABASE&lt;/span&gt; TestDB &lt;span style=&quot;color: blue;&quot;&gt;SET OFFLINE&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step2: Move file Physically&lt;/strong&gt; &lt;br /&gt;
Now you need to move that file physically from&amp;nbsp;existing folder to the new the location. Open the parent folder (Here &#39;C:\MSSQL\DATA&#39;) , You can see both mdf and ldf files&#39;, make sure that you cut the appropriate file, in this example it is the Log file. Cut that &quot;TestDB_log.LDF&quot; file and paste it on &quot;D:\MSSQL\Data&quot; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;strong&gt;Step3: Update the system reference&lt;/strong&gt; &lt;br /&gt;
Once you move the file physically , you need to update the system reference using the ALTER DATABASE .. MODIFY FILE Command as shown below: &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ALTER DATABASE &lt;/span&gt;TestDB &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;MODIFY FILE&lt;/span&gt; ( &lt;br /&gt;
&amp;nbsp;&amp;nbsp; NAME =&lt;span style=&quot;color: red;&quot;&gt;&#39;TestDB_log&#39;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; ,&lt;span style=&quot;color: blue;&quot;&gt;FILENAME&lt;/span&gt; = &lt;span style=&quot;color: red;&quot;&gt;&#39;D:\MSSQL\Data\TestDB.LDF&#39;&lt;/span&gt;&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step5 : Make database&amp;nbsp;ONLINE &lt;/strong&gt;&lt;br /&gt;
Last step is to make database online as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ALTER DATABASE &lt;span style=&quot;color: black;&quot;&gt;TestDB &lt;/span&gt;SET ONLINE&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
We are done. Now check existing files location using query mentioned above.&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/06/moving-database-files-from-one-drive-to.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikRKsEE5lbmN33RZ7I47rfPe8NBsarOlOlUbT_o5X_VYbdHLAgSYT5DavpzBvOG7qg6aBHjOGbI7ozHThZRGlMdgpH53YtXUPu7UJQCaxSwC5HTtXkFoq-0bQEiV5uTzIZoDM-RU8xnPiW/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-3342206569447407346</guid><pubDate>Fri, 06 May 2011 00:32:00 +0000</pubDate><atom:updated>2012-08-21T20:24:45.473-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Sequence Container</category><category domain="http://www.blogger.com/atom/ns#">SSIS</category><category domain="http://www.blogger.com/atom/ns#">SSIS Containers</category><title>Sequence Container in SSIS - Different ways of using Sequence Containers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Integration Services includes the Sequence container, which makes it simple to divide the control flow in a package into groups of tasks and containers that you can manage as a unit.&lt;br /&gt;
Using Sequence containers lets you handle the control flow in a package in more detail, without having to manage individual tasks and containers.&lt;br /&gt;
If a package has many tasks, it can be helpful to group the tasks in Sequence containers.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll explain different scenarios where Sequence Container paly an important role to implement business rules.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Scenario 1:&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitFas1yk0lk8jFamc36cgTH5i3oHqpX9dXWNoWz3_hMse5yPbdNVHAtfmgeVpHfDO5_YGqaAwxYiHo5xxBixrb0EgfSpVskBPuEDdJ5JnPvl9-LKMBCHxA40ww03X9N-GFxuvm8yIjsYQh/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;345&quot; hw=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitFas1yk0lk8jFamc36cgTH5i3oHqpX9dXWNoWz3_hMse5yPbdNVHAtfmgeVpHfDO5_YGqaAwxYiHo5xxBixrb0EgfSpVskBPuEDdJ5JnPvl9-LKMBCHxA40ww03X9N-GFxuvm8yIjsYQh/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC1&lt;/strong&gt; must execute first. SC1 may have many task with or without&amp;nbsp;precedence constraints. The group of these task must execute prior to any other tasks in the package.&lt;/li&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC2&lt;/strong&gt; must start&amp;nbsp;after completion of&amp;nbsp;SC1.&amp;nbsp;SC2 must execute irrespective of Failure/Success of SC1.&lt;/li&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC3&lt;/strong&gt; contains &lt;strong&gt;Maintenence Plan Tasks&lt;/strong&gt; and&amp;nbsp;should be followed by SC2. SC3 must execute only after successfully execution of SC2.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;strong&gt;Scenario 2:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHbzZGL_Z35re21axzLVLCz1RaSJfKLmOsJVVfLBWzlMe6R5LeXmcUtv6KUsfRztIcAJ6SRNebGHioWns0UOWmGBZrhyphenhyphen1WofJnu2c08g1zTxXh0dDh3G15xR-O6lU_sr5q-6N-Qd5wcyax/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;345&quot; hw=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHbzZGL_Z35re21axzLVLCz1RaSJfKLmOsJVVfLBWzlMe6R5LeXmcUtv6KUsfRztIcAJ6SRNebGHioWns0UOWmGBZrhyphenhyphen1WofJnu2c08g1zTxXh0dDh3G15xR-O6lU_sr5q-6N-Qd5wcyax/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC1&lt;/strong&gt; must execute first. &lt;/li&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC2 &lt;/strong&gt;must start based on logical condition. This condition can be based on&amp;nbsp;package variables.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Sequence Task &lt;strong&gt;SC3&lt;/strong&gt; contains Maintenence Plan Tasks and should be followed by both SC1 and SC2. SC3 must execute after successfully execution of SC1. SC3 should execute regardless of SC2 but if SC2 executes, SC3 must execute after SC2.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&amp;nbsp; &lt;strong&gt;Scenario 3&lt;/strong&gt;: This is real scenario in many BI applications. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja_NOBvBUuYLHVCQivqYV1sNrFfq8XNTmsnycZ5vvUtBitBZ5j2b7BDA7OdrVmNb5kVCLn_tcqWSpSQL2L2E9vdqGJReieJqKVKZHfijZv6A0VCG4Hc50J-yNxRt16tIMhTrJI3SVk6PyU/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;233&quot; hw=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja_NOBvBUuYLHVCQivqYV1sNrFfq8XNTmsnycZ5vvUtBitBZ5j2b7BDA7OdrVmNb5kVCLn_tcqWSpSQL2L2E9vdqGJReieJqKVKZHfijZv6A0VCG4Hc50J-yNxRt16tIMhTrJI3SVk6PyU/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;SC1 must execute&amp;nbsp;prior to other task. This Sequence Container may contain many tasks to pull data from hetrogenious data sources.&lt;/li&gt;
&lt;li&gt;SC2 should be followed by SC1. This can be used to Insert/Update dimension tables and&amp;nbsp;fact tables along with intermediate tables (if any).&amp;nbsp;This container may further contain Sub - Sequence Containers e.g. SC2(a) to handle dimension Insert/Update and SC2(b) to update Intermediate and Fact tables. &lt;/li&gt;
&lt;li&gt;SC3 should be followed by SC2. This may contains SSAS Tasks to Build/Prcoess Cubes. This container may also have Sub - Sequence Containers e.g. SC3(a) to check whether Current Month partition exists or not. If &lt;strong&gt;Yes&lt;/strong&gt; than &lt;strong&gt;Do Nothing&lt;/strong&gt; Else Create &lt;strong&gt;Current Month Partitions &lt;/strong&gt;using Script task. SC3(b) can be used to Process Dimensions and Current Month Partitions.&lt;/li&gt;
&lt;li&gt;SC4 can be used&amp;nbsp;for &lt;strong&gt;Maintenence Plan&lt;/strong&gt; tasks.&amp;nbsp;If SC3 successfully completed (Evolution operation - Expression and Constraint) than take Backup of Cube, Shrink Datamart and Take Backup of&amp;nbsp;Datamart.&lt;/li&gt;
&lt;li&gt;SC5 can be used for &lt;strong&gt;Recovery&lt;/strong&gt; Paln. If SC3 fails,&amp;nbsp;Restore Cube from previos &amp;amp; Latest Backup available.. &lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
However, there are many more ways of utilizing Sequence Containers. Further, things depends on complexity of business requirement rules defined.&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/07/sequence-container-in-ssis-different.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitFas1yk0lk8jFamc36cgTH5i3oHqpX9dXWNoWz3_hMse5yPbdNVHAtfmgeVpHfDO5_YGqaAwxYiHo5xxBixrb0EgfSpVskBPuEDdJ5JnPvl9-LKMBCHxA40ww03X9N-GFxuvm8yIjsYQh/s72-c/1.png" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-571146790265153510</guid><pubDate>Wed, 16 Mar 2011 04:42:00 +0000</pubDate><atom:updated>2012-08-21T20:26:40.463-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Foreach Loop Container</category><category domain="http://www.blogger.com/atom/ns#">SSIS</category><category domain="http://www.blogger.com/atom/ns#">SSIS Containers</category><title>Foreach Loop Enumerators</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The &lt;strong&gt;Foreach Loop&lt;/strong&gt; container defines a repeating control flow in a package. The loop implementation is similar to Foreach looping structure in programming languages but in a package, looping is enabled by using a Foreach enumerator. The Foreach Loop container repeats the control flow for each member of a specified enumerator.&lt;br /&gt;
&lt;br /&gt;
SSIS provides the following enumerator types:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhADAihUWDb1uheZG7ztJQHziMuBBK-soE-J0szOdRLEud_Ns_AcfF8DPDzodty2JU2vwk-WeQAfyTEoagfeXlc56hAifILHtaFLFRH_IyUyM-RilUzm5E4Ng73LFBh1L_mwUDaKusEOO4-/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;cssfloat: left; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;145&quot; ru=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhADAihUWDb1uheZG7ztJQHziMuBBK-soE-J0szOdRLEud_Ns_AcfF8DPDzodty2JU2vwk-WeQAfyTEoagfeXlc56hAifILHtaFLFRH_IyUyM-RilUzm5E4Ng73LFBh1L_mwUDaKusEOO4-/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Foreach File Enumerator &lt;/strong&gt;to enumerate files in a folder. The enumerator can traverse subfolders. For example, you can read all the files that have the &lt;strong&gt;*.csv&lt;/strong&gt; file name extension in the folder and its subfolders.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach Item Enumerator&lt;/strong&gt; to enumerate items that are collections. For example,&amp;nbsp;you can enumerate the names of executables and working directories that an Execute Process task uses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach ADO Enumerator&lt;/strong&gt; to enumerate rows in tables. For example, you can get the rows in an ADO recordset.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach ADO.NET Schema Rowset Enumerator&lt;/strong&gt; to enumerate the schema information about a data source. For example, you can enumerate and get a list of the tables of your SQL Server&amp;nbsp;database.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach From Variable Enumerator&lt;/strong&gt; to enumerate the object that a specified variable contains. The enumerable object can be an array, an ADO.NET DataTable, an Integration Services enumerator, and so on. For example, you can enumerate the values of an array that contains the name of Servers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach Nodelist Enumerator&lt;/strong&gt; to enumerate the result set of an XML Path Language (XPath) expression. For example, this expression enumerates and gets a list of all the products of Electronics type: /products/product[@type=&#39;Electronics&#39;].&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Foreach SMO Enumerator&lt;/strong&gt; to enumerate SQL Server Management Objects (SMO) objects. For example, you can enumerate and get a list of the views in a SQL Server database.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/06/foreach-loop-enumerators.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhADAihUWDb1uheZG7ztJQHziMuBBK-soE-J0szOdRLEud_Ns_AcfF8DPDzodty2JU2vwk-WeQAfyTEoagfeXlc56hAifILHtaFLFRH_IyUyM-RilUzm5E4Ng73LFBh1L_mwUDaKusEOO4-/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-569847427200624897</guid><pubDate>Sun, 02 Jan 2011 07:19:00 +0000</pubDate><atom:updated>2011-01-25T21:00:41.426-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSRS</category><category domain="http://www.blogger.com/atom/ns#">SSRS Expressions</category><category domain="http://www.blogger.com/atom/ns#">SSRS Grouping</category><title>Adding Custom Color in SSRS Chart Reports</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Do you ever come across a requirement where you need to use user defined colors instead of default colors in&amp;nbsp;a chart (for example Pie Chart).&lt;br /&gt;
&lt;br /&gt;
In this article, I&#39;ll explain how to create a &lt;strong&gt;Custom Palette&lt;/strong&gt; and how to use that palette&amp;nbsp;in a&amp;nbsp;&lt;strong&gt;Pie Chart&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOctKhRB0VbUpchVBQUzlv6mncppw8lEpOynjs-C6vS8lJpQKNibK4HqU0L6YXyQZ_S-wHluGRbZWhJBqQ7j3pkfmeTl5uB66tTmxlAyg_alU6el_DT2Vo51TgTRytSd3MDnuPMYPbgJr_/s1600/Chart1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;127&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOctKhRB0VbUpchVBQUzlv6mncppw8lEpOynjs-C6vS8lJpQKNibK4HqU0L6YXyQZ_S-wHluGRbZWhJBqQ7j3pkfmeTl5uB66tTmxlAyg_alU6el_DT2Vo51TgTRytSd3MDnuPMYPbgJr_/s400/Chart1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;In the above screen-shot, I am using color &lt;strong&gt;&lt;span style=&quot;color: blue;&quot;&gt;Blue&lt;/span&gt;, &lt;span style=&quot;color: red;&quot;&gt;Red&lt;/span&gt;, &lt;span style=&quot;color: #134f5c;&quot;&gt;Teal&lt;/span&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;span style=&quot;color: #f1c232;&quot;&gt;Gold&lt;/span&gt;&lt;/strong&gt; for the first four values of the &lt;strong&gt;Period &lt;/strong&gt;column&amp;nbsp;and same colors are used in &lt;strong&gt;Pie Chart&lt;/strong&gt; as well.&lt;br /&gt;
&lt;br /&gt;
Here are the steps to achieve this task:&lt;br /&gt;
&lt;br /&gt;
STEP1:&lt;br /&gt;
Create your custome color palette in the report using Custom Code in your report. To do so,&amp;nbsp;click &lt;strong&gt;Report&lt;/strong&gt; =&amp;gt; &lt;strong&gt;Report Properties&lt;/strong&gt; =&amp;gt; &lt;strong&gt;Code&lt;/strong&gt; and&amp;nbsp;copy below code:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Private colorPalette As String() = { &quot;Blue&quot;, &quot;Red&quot;, &quot;Teal&quot;, &quot;Gold&quot;, &quot;Green&quot;,&quot;#A59D93&quot;, &quot;#B8341B&quot;, &quot;#352F26&quot;, &quot;#F1E7D6&quot;, &quot;#E16C56&quot;, &quot;#CFBA9B&quot;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Private count As Integer = 0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Private mapping As New System.Collections.Hashtable()&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Public Function GetColor(ByVal groupingValue As String) As String&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; If mapping.ContainsKey(groupingValue) Then&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Return mapping(groupingValue)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; End If&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; Dim c As String = colorPalette(count Mod colorPalette.Length)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; count = count + 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; mapping.Add(groupingValue, c)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; Return c&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;End Function&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
You can define your own colors in the above function.&lt;br /&gt;
&lt;br /&gt;
STEP2:&lt;br /&gt;
In the Pie Chart, select &lt;strong&gt;Series Properties&lt;/strong&gt; and select the &lt;strong&gt;Fill&lt;/strong&gt; option from left side as shown below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOaWJMKtEnTAVhZmMJTMbUy9bMn-3eLEEJnrWH1kDCehcNFTLTCRf6grrYAjt3u2kYZ1OHo5aQrIFauMJBfN3uTeFMhQgsVX8wZBoxo6Qa46K0DiNcnJNqtSDoc9pgolgy16xzXKxyn4XI/s1600/Chart2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;285&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOaWJMKtEnTAVhZmMJTMbUy9bMn-3eLEEJnrWH1kDCehcNFTLTCRf6grrYAjt3u2kYZ1OHo5aQrIFauMJBfN3uTeFMhQgsVX8wZBoxo6Qa46K0DiNcnJNqtSDoc9pgolgy16xzXKxyn4XI/s320/Chart2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now write following expression in the &lt;strong&gt;Color&lt;/strong&gt; expression:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;=code.GetColor(Fields!Year.Value)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here &lt;strong&gt;Fields!Year.Value&lt;/strong&gt; is a field of dataset which is used as Chart &lt;strong&gt;Category&lt;/strong&gt; fields.&lt;br /&gt;
&lt;br /&gt;
STEP3:&lt;br /&gt;
In the left most column of the tabular report, insert&amp;nbsp;character &lt;span style=&quot;color: black; font-family: Arial; font-size: 8pt; font-style: normal; font-weight: 400; text-decoration: none;&quot;&gt;█ &lt;/span&gt;and in the &lt;strong&gt;color&lt;/strong&gt; property of the textbox write following expression:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-family: Courier New;&quot;&gt;=code.GetColor(Fields!Year.Value)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here I am considing that tabular report is grouped on &lt;strong&gt;Fields!Year.Value &lt;/strong&gt;field.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirMzLyfQdhzB4fhUGdDL7RXbA_TW4dm16cnHCUM7kxmwAmV0B0vJHKItWpQacPsqN5Plarob0F1xU3PgNkqcmDbtWJjNhVz7UR_uCtN1FpY8fruZrXTfsaoLL3JWAXZhQZE-gBtdocOH-2/s1600/Chart3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;115&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirMzLyfQdhzB4fhUGdDL7RXbA_TW4dm16cnHCUM7kxmwAmV0B0vJHKItWpQacPsqN5Plarob0F1xU3PgNkqcmDbtWJjNhVz7UR_uCtN1FpY8fruZrXTfsaoLL3JWAXZhQZE-gBtdocOH-2/s320/Chart3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Thats it. Click on the preview and enjoy your custom colors in charting.&lt;br /&gt;
&lt;br /&gt;
Cheers!!!&lt;/div&gt;</description><link>http://sql-bi-dev.blogspot.com/2010/12/adding-custom-color-in-ssrs-chart.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOctKhRB0VbUpchVBQUzlv6mncppw8lEpOynjs-C6vS8lJpQKNibK4HqU0L6YXyQZ_S-wHluGRbZWhJBqQ7j3pkfmeTl5uB66tTmxlAyg_alU6el_DT2Vo51TgTRytSd3MDnuPMYPbgJr_/s72-c/Chart1.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-6908962778952359339</guid><pubDate>Sun, 12 Dec 2010 22:05:00 +0000</pubDate><atom:updated>2012-12-20T17:11:38.983-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Analysis Services  Processing Task</category><category domain="http://www.blogger.com/atom/ns#">Analysis Services Execute DDL Task</category><category domain="http://www.blogger.com/atom/ns#">Cube</category><category domain="http://www.blogger.com/atom/ns#">Script Task</category><category domain="http://www.blogger.com/atom/ns#">Sequence Container</category><category domain="http://www.blogger.com/atom/ns#">SSAS</category><title>Dynamic Cube Partitioning in SSAS 2008</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this article I am going to explain the &lt;strong&gt;Implementaion of Dynamic Cube Partition&lt;/strong&gt; in SSAS 2008. I would want to split this article in two parts as mentioned below: &lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Partition benefits&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Implementing&amp;nbsp;Dynamic Partitions&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Partition Benefits:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Better Query Performance&lt;/strong&gt;: Cube partition is a powerful mechanism for improving query performance. Queries that summarize data over 10 years could take considerably longer than those that only search through the current year data. If&amp;nbsp;we have proper partitions then SSAS only has to scan a small subset of data to return query results hence dramatic performance improvements compared to queries running against a cube with a single partition.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Minimize downtime&lt;/strong&gt;:&amp;nbsp; Cube partitioning&amp;nbsp;supports reducing downtime associated with cube processing. In almost all the cases,&amp;nbsp;a portion of data warehouse is volatile and needs to be processed often. However other portions are relatively static. For example, in a sales cube,&amp;nbsp;we need to change the current year&#39;s data nightly, but sales from previous years might change only occasionally - in case if account for merchandise returns and exchanges.&amp;nbsp;If your warehouse tracks last 10 years salesthen processing only the current partition may be 10 times quicker than processing the entire cube. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aggregations benefits&lt;/strong&gt;: The partition queried frequently could benefit from additional aggregations, which in turn could improve performance. Partition(s) that are used less can be processed less frequently with considerably fewer aggregations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Customized storage and processing settings&lt;/strong&gt;: Frequently accessed partitions might benefit from proactive caching and ROLAP storage. On the other hand, other forms of storage and processing might be better for less frequently queried partitions.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Distributed query and processing load&lt;/strong&gt;: SSAS allows you to create remote partitions - a remote partition resides on a server different from its parent cube. This way the queries that affect the remote partition are processed on a server separate from its parent cube, allowing you to take advantage of additional processing power.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Parallel Partitions Processing&lt;/strong&gt;: SSAS allows processing multiple partitions in parallel on a server that has multiple processors. This can further reduce the total cube processing time. &lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&amp;nbsp;&lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Implementing Dynamic Partitions&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
In this section I will explain step by step operations to create Dynamic Cube Partitions.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
STEP1:&lt;br /&gt;
Preapare test data for &lt;strong&gt;Sales&lt;/strong&gt; cube. I will use three dimensions (DimDate, DimProduct, and DimCustomer) and one fact table for Sales cube. Click &lt;strong&gt;&lt;u&gt;&lt;a href=&quot;https://docs.google.com/leaf?id=0B61zdXHFOYmpY2FlNzlkZTItNGUxZC00ZmIwLWFlYjUtMGU5NjZkYTgwYjE4&amp;amp;hl=en&quot;&gt;here&lt;/a&gt;&lt;/u&gt;&lt;/strong&gt;&amp;nbsp;to&amp;nbsp;download&amp;nbsp;&lt;strong&gt;CubePartitionData.sql&lt;/strong&gt; file which contains T-SQL code to generate these tables along with sample data.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
STEP2:&lt;br /&gt;
Create new Analysis Services Project&amp;nbsp;using BIDS and save it as &lt;strong&gt;Sales&lt;/strong&gt;. &lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
STEP3:&lt;br /&gt;
Create &lt;strong&gt;Data Source&lt;/strong&gt;, and then &lt;strong&gt;Data Souce View &lt;/strong&gt;using above three dimension tables. &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSFK9ifll5M2sy6Nb4EhSPSMLLx3mVaUhzqQznlC2Un6C2TldpFuRb4WByEE6_STArwgz5xKcu4vlT5s2ZQ8Gxx8XeBwqwhp8SWSWygXKUf_jXzFbUJ-zGcHU2b4ohqBw-mu8oHQ1311C/s1600/DCP1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;151&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSFK9ifll5M2sy6Nb4EhSPSMLLx3mVaUhzqQznlC2Un6C2TldpFuRb4WByEE6_STArwgz5xKcu4vlT5s2ZQ8Gxx8XeBwqwhp8SWSWygXKUf_jXzFbUJ-zGcHU2b4ohqBw-mu8oHQ1311C/s320/DCP1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
If you are newbie, click &lt;a href=&quot;http://sql-bi-dev.blogspot.com/2010/08/creating-first-cube-in-ssas-2008.html&quot;&gt;&lt;strong&gt;Creating First Cube in SSAS 2008&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;for more information.&lt;br /&gt;
&lt;br /&gt;
STEP4:&lt;br /&gt;
Create&amp;nbsp;&lt;strong&gt;Sales&lt;/strong&gt; cube&amp;nbsp; along with required dimensions. Set all&amp;nbsp; required properties of dimensions and create any hierarchies if required. My Solution looks like this:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWZ4HwqxG8E5l1iI-wVwdvUktgaZOy7iMyGCQ7s_T7-pVi06qA4t8oNPSPFuwYPoJVGFzg2lVwIQLJ51ns0xN2EEXB-UbcSLxYQAZya-YtJ3xSdipEiE-89mfHk2Dd6t6jsqDFqnFeaGo0/s1600/Cube0.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;218&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWZ4HwqxG8E5l1iI-wVwdvUktgaZOy7iMyGCQ7s_T7-pVi06qA4t8oNPSPFuwYPoJVGFzg2lVwIQLJ51ns0xN2EEXB-UbcSLxYQAZya-YtJ3xSdipEiE-89mfHk2Dd6t6jsqDFqnFeaGo0/s320/Cube0.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
STEP5:&lt;br /&gt;
Double click on the cube and navigate to &lt;strong&gt;Partition&lt;/strong&gt; tab. You will see a default partition as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhge2gJdrnyNhoSmzxL0TM2danIzF1zhyphenhyphenW6TLNwFpqA5P5d5FmvoPniZVA8Yu2H_M6YOpayCp8mjehkXW0ASS3r9MamIqYTLh5IpGUiD_5dpQJwWFxeBhy2_47MVjTYoD2HftuIVxPUEVhG/s1600/DCP2DefaultPartition.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;74&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhge2gJdrnyNhoSmzxL0TM2danIzF1zhyphenhyphenW6TLNwFpqA5P5d5FmvoPniZVA8Yu2H_M6YOpayCp8mjehkXW0ASS3r9MamIqYTLh5IpGUiD_5dpQJwWFxeBhy2_47MVjTYoD2HftuIVxPUEVhG/s320/DCP2DefaultPartition.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Delete this default partition and Click on &lt;strong&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;u&gt;new partition...&lt;/u&gt;&lt;/span&gt;&lt;/strong&gt; to click new partition. In &lt;em&gt;Partition Wizard, &lt;/em&gt;Select FactSales as available table in &lt;strong&gt;Specify Source Information&lt;/strong&gt; page&amp;nbsp;and click next. Select &lt;strong&gt;Specify a query to restict row&lt;/strong&gt; in &lt;strong&gt;Restrict Rows&lt;/strong&gt; page and write WHERE condition to restrict partition rows.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPt_BKaF_Afi6auBbjDiy70mOWz8IGwZ5mnvVBBZboWm4EkAAPka9O-8dyOCCHWzIXVP4kvHDymCpobZrVC9T93w_ChGmSMh_aru_BaQJ_eECTF7Y-fs-xkGgEXyoTNk2ndgIDV9yud_5d/s1600/DCP2DefaultPartition1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;291&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPt_BKaF_Afi6auBbjDiy70mOWz8IGwZ5mnvVBBZboWm4EkAAPka9O-8dyOCCHWzIXVP4kvHDymCpobZrVC9T93w_ChGmSMh_aru_BaQJ_eECTF7Y-fs-xkGgEXyoTNk2ndgIDV9yud_5d/s320/DCP2DefaultPartition1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Click &lt;strong&gt;Next&lt;/strong&gt; twice and enter Partition name &lt;strong&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Sales_20100101-20100131&lt;/span&gt;&lt;/strong&gt; in the &lt;strong&gt;Completing the Wizard&lt;/strong&gt; page and click &lt;strong&gt;Finish&lt;/strong&gt;. &lt;br /&gt;
Finally &lt;strong&gt;Process&lt;/strong&gt; the cube. Once cube is processed successfully, you can see a new database in Analysis Services:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg-P67ypsIZtI8FGvEBcbF3wyI7CUciaJcSLAh8oET49ZUjFUG9Z7PJYz354oMldJaQi-gtw7GaLlxfKqxGJu_TsPfbL1XXARWjiA4AYsCp2b2TKgx_LFOTIgu1Htpc9mIiESDJJbpKHlH/s1600/DCP2DefaultPartitionDB.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjg-P67ypsIZtI8FGvEBcbF3wyI7CUciaJcSLAh8oET49ZUjFUG9Z7PJYz354oMldJaQi-gtw7GaLlxfKqxGJu_TsPfbL1XXARWjiA4AYsCp2b2TKgx_LFOTIgu1Htpc9mIiESDJJbpKHlH/s320/DCP2DefaultPartitionDB.png&quot; width=&quot;255&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
You can&amp;nbsp;browse the data for this partition:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsdf4FvRI9Sw6G70pOapEV2S59Of8QU6fhIbqFDdSGFYROxbNjOWDv3N2KK3aDbJLwmTESLcHf2Vho48C1oxAeykI-QMnUEdZEhNTob02yVd6hyT9Em00Mq_muw1SikddkG9C_PCT0bpiX/s1600/DCP2DefaultPartitionDBData1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsdf4FvRI9Sw6G70pOapEV2S59Of8QU6fhIbqFDdSGFYROxbNjOWDv3N2KK3aDbJLwmTESLcHf2Vho48C1oxAeykI-QMnUEdZEhNTob02yVd6hyT9Em00Mq_muw1SikddkG9C_PCT0bpiX/s320/DCP2DefaultPartitionDBData1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
STEP6:&lt;br /&gt;
We are done with one manual partition. Now its time to create the partitions dynamically and apply a logic to process the delta data every time.&lt;br /&gt;
&lt;br /&gt;
First off all, right click on the Partition &lt;strong&gt;Sales_20100101-20100131&lt;/strong&gt;&amp;nbsp;(highlighted above)&amp;nbsp; and then select &lt;strong&gt;Script Partition as &lt;/strong&gt;==&amp;gt; &lt;strong&gt;Create To&lt;/strong&gt; ==&amp;gt; &lt;strong&gt;New Query Editor Window&lt;/strong&gt;. It will create XMLA scripts for this partition. Save this file in the project&amp;nbsp;with &lt;strong&gt;CreatePartitionSales_20100101-20100131.xmla &lt;/strong&gt;name.&lt;br /&gt;
&lt;br /&gt;
In similar fashion, right click on the Partition &lt;strong&gt;Sales_20100101-20100131&lt;/strong&gt;&amp;nbsp;and then select &lt;strong&gt;Process&lt;/strong&gt;. This will open Process Partition wizard, click &lt;strong&gt;Script&lt;/strong&gt; to generate XMLA script and save this file&amp;nbsp;in the project&amp;nbsp;with&amp;nbsp;&lt;strong&gt;CreatePartitionSales_20100101-20100131.xmla&lt;/strong&gt; name.&lt;br /&gt;
&lt;br /&gt;
STEP7:&lt;/div&gt;
&lt;div&gt;
We are done with SSAS development! Now we have to create an SSIS package to implement dynamic creation of cube partition and processing of that partition.&lt;br /&gt;
&lt;br /&gt;
Click on &lt;strong&gt;File&lt;/strong&gt; =&amp;gt; &lt;strong&gt;Add&lt;/strong&gt; =&amp;gt; &lt;strong&gt;New Project&lt;/strong&gt;&amp;nbsp;in menu bar in the same solution. Select &lt;strong&gt;Integration Services Project&lt;/strong&gt; and enter the name of the SSIS Project. &lt;br /&gt;
Rename the SSIS package1.dtsx by DynamicSalesPartition.dtsx.&lt;br /&gt;
&lt;br /&gt;
STEP8:&lt;br /&gt;
Add two connection Managers - one OLE DB connection manager for database and another Analysis Services connection manager for SSAS database.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAMrhD3QKG4d_S_7Wdo24H1mB3Ld949jHfX9RJjocKlpgA66f-SNOzvB7Org2NvSPx-Ra8yPpnoY4pry0LiqnJeUp8xnuWGc7eJrLJiV1GdqfmO1_KFtuR0OJ5IrOfeaOjvXUvSENHn8kN/s1600/ConnMgr.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAMrhD3QKG4d_S_7Wdo24H1mB3Ld949jHfX9RJjocKlpgA66f-SNOzvB7Org2NvSPx-Ra8yPpnoY4pry0LiqnJeUp8xnuWGc7eJrLJiV1GdqfmO1_KFtuR0OJ5IrOfeaOjvXUvSENHn8kN/s1600/ConnMgr.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
STEP9:&lt;br /&gt;
Add following Package variables:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9g0V05iYFZtsnxW-19TVI4JSBcNpwfhbb3n1hdSXf1Xw-99fuO9H8apdqOxRVEo2l0BBtMBJesfUB0JOW6nq5AxfPbVrReLM4IMVh4HdxQm133MZX5f11LVW0qXwplnhW8bQSYSyawHr1/s1600/PkgVariables.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;129&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9g0V05iYFZtsnxW-19TVI4JSBcNpwfhbb3n1hdSXf1Xw-99fuO9H8apdqOxRVEo2l0BBtMBJesfUB0JOW6nq5AxfPbVrReLM4IMVh4HdxQm133MZX5f11LVW0qXwplnhW8bQSYSyawHr1/s320/PkgVariables.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Here is the brief description of each variable:&lt;/div&gt;
&lt;strong&gt;Directory&lt;/strong&gt; - To store package path&lt;br /&gt;
&lt;strong&gt;FromDateKey&lt;/strong&gt; - To Store current partition start date key e.g. 20101201.&lt;br /&gt;
&lt;strong&gt;ToDateKey&lt;/strong&gt; - To Store current partition end date e.g. 20101231&lt;br /&gt;
&lt;strong&gt;PartitionName&lt;/strong&gt; - Current partition name e.g. SalesPartition_20101201-20101231&lt;br /&gt;
&lt;strong&gt;IsPartitionExists&lt;/strong&gt; - To check whether partition alreday exists or not&lt;br /&gt;
&lt;strong&gt;CreatePartitionXMLA&lt;/strong&gt; - To store XMLA script&amp;nbsp;to create&amp;nbsp;current partition&lt;br /&gt;
&lt;strong&gt;ProcessPartitionXMLA&lt;/strong&gt;- To store XMLA script&amp;nbsp;to process&amp;nbsp;current partition&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Note: You can add more variables as per need and business requirement.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
STEP10&lt;/div&gt;
&lt;div&gt;
Now you have to develop SSIS package as shown below:&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuW6KHS7Hq22Slyqf3NPpNXxboTU9adGHamr-BY9G2NAr4fGM-H4DdIh06qohXCfnO8n33heoicaiDAlvVe955jhDqDkMdNKw-zU1gfX-U9PlSgb1NwQxR6WZ2mnVXrO0wuc0eHAMMlaT9/s1600/DCPFinalPackageLayout.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;272&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuW6KHS7Hq22Slyqf3NPpNXxboTU9adGHamr-BY9G2NAr4fGM-H4DdIh06qohXCfnO8n33heoicaiDAlvVe955jhDqDkMdNKw-zU1gfX-U9PlSgb1NwQxR6WZ2mnVXrO0wuc0eHAMMlaT9/s320/DCPFinalPackageLayout.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;﻿&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
First Execute SQL Task is used to initialize FromDateKey, ToDateKey, and PartitionName for the current partition. Use below query in this Task:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@FromDateKey &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(8), @ToDateKey &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(8), &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; @CalendarYear &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;, @CalendarMonth &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;@FromDateKey = &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;(FromDateKey),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; @ToDateKey = &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;(ToDateKey) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; PartitionLog (&lt;span style=&quot;color: blue;&quot;&gt;NOLOCK&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; @CalendarYear = &lt;span style=&quot;color: magenta;&quot;&gt;MIN&lt;/span&gt;(CalendarYear), &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; @CalendarMonth = &lt;span style=&quot;color: magenta;&quot;&gt;MIN&lt;/span&gt;(CalendarMonth) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; DimDate &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; DateKey &amp;gt; @ToDateKey + 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;--SET FromDateKey and ToDateKey for current Partition&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: #666666;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(8),&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;(),112) &lt;span style=&quot;color: #666666;&quot;&gt;BETWEEN&lt;/span&gt; @FromDateKey &lt;span style=&quot;color: #666666;&quot;&gt;AND&lt;/span&gt; @ToDateKey &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; @FromDateKey = &lt;span style=&quot;color: magenta;&quot;&gt;MIN&lt;/span&gt;(DateKey), &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;@ToDateKey = &lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;(DateKey)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; DimDate (&lt;span style=&quot;color: blue;&quot;&gt;NOLOCK&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; CalendarYear = @CalendarYear &lt;span style=&quot;color: #666666;&quot;&gt;AND&lt;/span&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;CalendarMonth = @CalendarMonth &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; @FromDateKey &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; FromDateKey, @ToDateKey &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ToDateKey,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Sales_&#39;&lt;/span&gt; + @FromDateKey + &lt;span style=&quot;color: red;&quot;&gt;&#39;-&#39;&lt;/span&gt; + @ToDateKey &lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;PartitionName&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;GO&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Second Task in the package is &lt;strong&gt;Script Task&lt;/strong&gt;. Here we need to read the contents of files&lt;br /&gt;
&lt;strong&gt;CreatePartitionSales_20100101-20100131.xmla&lt;/strong&gt; and &lt;br /&gt;
&lt;strong&gt;ProcessPartitionSales_20100101-20100131.xmla &lt;/strong&gt;and store in the package variables CreatePartitionXMLA &amp;amp; ProcessPartitionXMLA.&lt;br /&gt;
&lt;br /&gt;
I am using User::Directory as ReadOnlyVariable and User::CreatePartitionXMLA,User::ProcessPartitionXMLA as ReadWriteVariables.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Click &lt;strong&gt;&lt;a href=&quot;https://docs.google.com/leaf?id=0B61zdXHFOYmpNTlkYTk3YzItY2M1NC00OGZmLWI4OWMtMTRjMTNlMjJiNmI4&amp;amp;hl=en&quot;&gt;here&lt;/a&gt;&lt;/strong&gt; to download the code for &lt;strong&gt;Script Task - Read XMLA Files and store in variables&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
To know about&amp;nbsp;reading file contents using Script Task, click&amp;nbsp;&lt;strong&gt;&lt;a href=&quot;http://sql-bi-dev.blogspot.com/2010/09/script-task-to-read-file.html&quot;&gt;Script Task to Read File&lt;/a&gt;&lt;/strong&gt;.&lt;/div&gt;
&lt;br /&gt;
Third Task is a sequence container which contains three task - Script Task, Analysis Services Execute DDL Task, and Execute SQL Task.&lt;br /&gt;
&lt;br /&gt;
Script Task is used for two reasons - &lt;br /&gt;
1. To check whether current partition exists or not. &lt;br /&gt;
2.&amp;nbsp;To update XMLA content for current Partition.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #741b47;&quot;&gt;This is the most tricky and interseting part here.&lt;/span&gt;&lt;/strong&gt; We need to replace Partition &lt;strong&gt;ID&lt;/strong&gt;, Partition &lt;strong&gt;Name&lt;/strong&gt;, and Source &lt;strong&gt;QueryDefinition&lt;/strong&gt; for current Partition which are highlighted below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYsP6P0gQIiVklrkSK6rHNI2Whtbo0zuOwfB4qtZJz7KQsZGiXPpy288BD6v1-FAFEd1krgAxxtGfFC3wyrk5_EhBcS-7EkxfcFxIQl4lzguMf9POEYt0bmEy4vDxPKuYoHggtdOiEJg-b/s1600/DCP2DefaultPartitionXMLA.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYsP6P0gQIiVklrkSK6rHNI2Whtbo0zuOwfB4qtZJz7KQsZGiXPpy288BD6v1-FAFEd1krgAxxtGfFC3wyrk5_EhBcS-7EkxfcFxIQl4lzguMf9POEYt0bmEy4vDxPKuYoHggtdOiEJg-b/s320/DCP2DefaultPartitionXMLA.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
In Script Task, select &lt;strong&gt;User::FromDateKey&lt;/strong&gt;,&lt;strong&gt;User::PartitionName&lt;/strong&gt;,&lt;strong&gt;User::ToDateKey&lt;/strong&gt; as ReadOnlyVariables and &lt;strong&gt;User::CreatePartitionXMLA&lt;/strong&gt;,&lt;strong&gt;User::ProcessPartitionXMLA&lt;/strong&gt;,&lt;strong&gt;User::IsPartitionExists&lt;/strong&gt; as ReadWriteVariables.&lt;br /&gt;
&lt;br /&gt;
Click &lt;strong&gt;&lt;a href=&quot;https://docs.google.com/leaf?id=0B61zdXHFOYmpYTUzMTNjYWQtMjcwZC00ZDdhLWIxYzctNDdjN2RjNzQ5YTA5&amp;amp;hl=en&quot;&gt;here&lt;/a&gt;&lt;/strong&gt; to download the code for &lt;strong&gt;Script Task - Generate XMLA to create and Process new Partition&lt;/strong&gt;.&lt;br /&gt;
&lt;br /&gt;
Click &lt;strong&gt;&lt;a href=&quot;http://sql-bi-dev.blogspot.com/2010/09/ssis-script-task-to-find-and-replace.html&quot;&gt;SSIS Script Task to Find and Replace File contents&lt;/a&gt;&lt;/strong&gt; to know more about &lt;strong&gt;find and replace&lt;/strong&gt; mechanism using script task. &lt;br /&gt;
&lt;br /&gt;
Second task in the sequence Container is Analysis Services Execute DDL Task. This task is used to create new Partition. In &lt;em&gt;Analysis Services Execute DDL Task Editor&lt;/em&gt;, select &lt;strong&gt;SSAS.localhost&lt;/strong&gt; as Connection, &lt;strong&gt;Variable&lt;/strong&gt; as SourceType, and &lt;strong&gt;User::CreatePartitionXMLA&lt;/strong&gt; as Source.&lt;br /&gt;
&lt;br /&gt;
Also don&#39;t forget to set precedence constraint. You should execute this task only when partition does not exists.&amp;nbsp;Open &lt;em&gt;Precedence Constraint Editor&lt;/em&gt; and Select &lt;strong&gt;Expression and Constraint&lt;/strong&gt; in Evolution operation, &lt;strong&gt;Success&lt;/strong&gt; in Value, and &lt;strong&gt;@IsPartitionExists == 0&lt;/strong&gt; in Expression as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7xTgZMc5koLnkGtqWnq1H1SXCEQ9yejll3gLburk8tT0cfYmpLAAikDv8ZV3fFLhME-j7dL3NZvICYz6DMI9eCdmdFgO9bWvuG6VCMRGWTMDPpBDjhyphenhyphenCePm3UZbkYVEjkK-h0-iJYZP_F/s1600/IsPartitionExists.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;238&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7xTgZMc5koLnkGtqWnq1H1SXCEQ9yejll3gLburk8tT0cfYmpLAAikDv8ZV3fFLhME-j7dL3NZvICYz6DMI9eCdmdFgO9bWvuG6VCMRGWTMDPpBDjhyphenhyphenCePm3UZbkYVEjkK-h0-iJYZP_F/s320/IsPartitionExists.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Third Task in the Sequence Container is Execute SQL Task - this is used to store newly created&amp;nbsp;Partition information in the PartitionLog table. In Execute SQL Task, select ResultSet &lt;strong&gt;None&lt;/strong&gt;, ConnectionType &lt;strong&gt;OLE DB&lt;/strong&gt;, Connection &lt;strong&gt;(local).Test&lt;/strong&gt;, SQLSourceType &lt;strong&gt;Direct input&lt;/strong&gt; and SQLStatement as:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;INSERT INTO &lt;/span&gt;dbo.PartitionLog&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;[PartitionName],[FromDateKey],[ToDateKey],[CreatedDate]) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;VALUES &lt;/span&gt;(?,?,?,&lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;())&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Click on Parameter Mapping and map the parameters as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoQ8rFCQVSAfNxCZNaGTBlW3hyphenhyphenG-h5D4uy3aaDqcv5czpWv49taTKapCmLssoEVZW_40fJE6UgatHq4u45_jWTb2X08pAIOiFk6GaHawCd9hKOFGOeib5GBdHWa9m3DTrLNF9-uvVoBQrm/s1600/ParamMapping.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;61&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoQ8rFCQVSAfNxCZNaGTBlW3hyphenhyphenG-h5D4uy3aaDqcv5czpWv49taTKapCmLssoEVZW_40fJE6UgatHq4u45_jWTb2X08pAIOiFk6GaHawCd9hKOFGOeib5GBdHWa9m3DTrLNF9-uvVoBQrm/s320/ParamMapping.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
STEP11&lt;br /&gt;
Finally we need to process the current partition. This is independent of previous sequence container&amp;nbsp;where we are creating new partition if it is not exists.&lt;br /&gt;
However,&amp;nbsp;we need to process the current partition every time we execute the package.&amp;nbsp;In most of the cases, new partition will be created on the first day of month but partition should be processed everyday to include delta data.&lt;br /&gt;
&lt;br /&gt;
This sequence container&amp;nbsp;also contains three tasks.&lt;br /&gt;
&lt;br /&gt;
First task is &lt;strong&gt;Analysis Services Processing Task&lt;/strong&gt; - to process the dimensions data. Select &lt;strong&gt;SSAS.localhost&lt;/strong&gt; as connection manager and all the dimensions in Object Name - which are not static in data.&amp;nbsp;Select &lt;strong&gt;Process Update&lt;/strong&gt; as Process Option.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpuMYLAPFTNSOVFngpwoOVH9VFhQJL2VZFXA5mZVvolVhbNNNZ6rg_2i8I2E6lelF6ahLgBmQyAToVSXtfwlsTRUKt0dwUysQnhRadglddWl14tJMtpgFfm0NQ9MpQDt01J6g_zcfoAaN9/s1600/ProcessDimension.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;131&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpuMYLAPFTNSOVFngpwoOVH9VFhQJL2VZFXA5mZVvolVhbNNNZ6rg_2i8I2E6lelF6ahLgBmQyAToVSXtfwlsTRUKt0dwUysQnhRadglddWl14tJMtpgFfm0NQ9MpQDt01J6g_zcfoAaN9/s320/ProcessDimension.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Second Task is againg &lt;strong&gt;Analysis Serives Processing Task &lt;/strong&gt;- to process Current Partition. Select &lt;strong&gt;SSAS.localhost&lt;/strong&gt; as connection manager and&amp;nbsp;Sales_20100101-20100131 in Object Name - which is default partition (or first partition).&amp;nbsp;Select &lt;strong&gt;Process Full &lt;/strong&gt;as Process Option.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAV-XrwVXdzfT4QQ_O_WhWb9-GUafMarbMV4XOfZmFFiyhbUO__9GMAhU8XrvCnWABVSN4lwrxG9USsolQB3JPN0E8vh55LnDL6RBXV2uQcQsa3HaffvLaOb5O0uhEtiGbRnlc9mEkx6E0/s1600/ProcessPartition.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;130&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAV-XrwVXdzfT4QQ_O_WhWb9-GUafMarbMV4XOfZmFFiyhbUO__9GMAhU8XrvCnWABVSN4lwrxG9USsolQB3JPN0E8vh55LnDL6RBXV2uQcQsa3HaffvLaOb5O0uhEtiGbRnlc9mEkx6E0/s320/ProcessPartition.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Now click on Expression and select &lt;strong&gt;@[User::ProcessPartitionXMLA]&lt;/strong&gt; in ProcessingCommands.&lt;br /&gt;
&lt;br /&gt;
Finally store the Last Processed Date and Processed Count (number of time this partition has processed) in the log table using Execute SQL task. Select ResultSet &lt;strong&gt;None&lt;/strong&gt;, ConnectionType &lt;strong&gt;OLE DB&lt;/strong&gt;, Connection &lt;strong&gt;(local).Test&lt;/strong&gt;, SQLSourceType &lt;strong&gt;Direct input &lt;/strong&gt;and SQLStatement as:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE &lt;/span&gt;PartitionLog&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; LastProcessDate = &lt;span style=&quot;color: magenta;&quot;&gt;GETDATE&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;,ProcessedCount = ProcessedCount + 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; PartitionName = ?&lt;/span&gt; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Click on Parameter Mapping and map the parameters and map the parameter 0 with &lt;strong&gt;User::PartitionName&lt;/strong&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
STEP12&lt;br /&gt;
We are done with package development. Now its time to execute the package and check the dynamic behaviour of Partition creation and processing. Before execution the package, there is only partition in the SSAS Sale database. &lt;br /&gt;
Now Right Click on the package and execute it. Once package is execute successfully, you will see one more partition in the Sales database and one more entry in PartitionLog table. &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_TEkYts1swkGS-623ML1sWnzya0mx589X-fzOgi3DNdRqX6uAYPJ2nBE9jzn4wfTGL0AFTn-FOWGuUlM8We-ZkL7YeJtNzJTrHqubAzrf_UIRmjbKV8Cykrzd_A72EE4GMhyMEY2FKR5g/s1600/DCPFinalPackageLayoutExec.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;254&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_TEkYts1swkGS-623ML1sWnzya0mx589X-fzOgi3DNdRqX6uAYPJ2nBE9jzn4wfTGL0AFTn-FOWGuUlM8We-ZkL7YeJtNzJTrHqubAzrf_UIRmjbKV8Cykrzd_A72EE4GMhyMEY2FKR5g/s320/DCPFinalPackageLayoutExec.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkV3aO-VwuGGB0oO9wSp2NIlGL5RftTnDgFSjINXn5OG4DxuUWeWmSMdYIPvvuxNTW4Sv7zTL3C2gfjljAJCpigReAFf1gaYSmKMzYQS6vjRztzuOqwE2AANJ-GcFZaazh4XYCR7HznIf2/s1600/DCPFinalPackageLayoutExec0.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;65&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkV3aO-VwuGGB0oO9wSp2NIlGL5RftTnDgFSjINXn5OG4DxuUWeWmSMdYIPvvuxNTW4Sv7zTL3C2gfjljAJCpigReAFf1gaYSmKMzYQS6vjRztzuOqwE2AANJ-GcFZaazh4XYCR7HznIf2/s320/DCPFinalPackageLayoutExec0.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Now Execute the package or schedule it to execute automatically. Once you are done with 10 more executions, you will reach to current month partition &lt;strong&gt;Sales_20101201-20101231&lt;/strong&gt;. and you can see 12 partitions - one partition for each month as shown below:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrdCsgrcM_sdsN49iU3z5Su4xKXAxhsyhgvbeagzhLKB9-r7T3GAmUEnZD9JE6eiRmDDFnQLVQkx-d_WKAx0CaHZEfyY_cpctXWzQeBCynnHjnKhrB4hpNl-nmmpk6OeKm8BuvPvC5ws3c/s1600/PartitionLogAll.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;104&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrdCsgrcM_sdsN49iU3z5Su4xKXAxhsyhgvbeagzhLKB9-r7T3GAmUEnZD9JE6eiRmDDFnQLVQkx-d_WKAx0CaHZEfyY_cpctXWzQeBCynnHjnKhrB4hpNl-nmmpk6OeKm8BuvPvC5ws3c/s320/PartitionLogAll.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
Since you are in current month partition, if you execute the package every day in current month - it will not create any new partition till beginning of next month. It will only process Current Partition to include the data in the cube as shown below:&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEiws9lMZkTDV28sVNPiHvCOG0qYgCRJx3cK576sJN-3q7RqXhuZNpg88uZOJY0GILaDNikSQJHpyM4J_ZbNipho0oV5JkCS-Ie0U145RAbjfHM59pyc7FbiSQOHep3vk_-l55clB_ol8B/s1600/DCPFinalPackageLayoutExec1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;242&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEiws9lMZkTDV28sVNPiHvCOG0qYgCRJx3cK576sJN-3q7RqXhuZNpg88uZOJY0GILaDNikSQJHpyM4J_ZbNipho0oV5JkCS-Ie0U145RAbjfHM59pyc7FbiSQOHep3vk_-l55clB_ol8B/s320/DCPFinalPackageLayoutExec1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you can browse the data for all the partitions:&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG-igb0EbJldPrHnu8-h62Y7Ov2lSGcRb83kuVbP6LuAeGJLfTn4zjbPD16aCVFazfe6wM_BVqO0vqZ4Q_Q-ym4SLCbQTFWn4T1ml11kR5OKcbIOFeg_xMTopMFuwnguzXBcfQMusrkYQb/s1600/DCP2DefaultPartitionDBData2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;206&quot; n4=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiG-igb0EbJldPrHnu8-h62Y7Ov2lSGcRb83kuVbP6LuAeGJLfTn4zjbPD16aCVFazfe6wM_BVqO0vqZ4Q_Q-ym4SLCbQTFWn4T1ml11kR5OKcbIOFeg_xMTopMFuwnguzXBcfQMusrkYQb/s320/DCP2DefaultPartitionDBData2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
We are done with Dynamic Package creation. &lt;br /&gt;
I hope you will like this article&amp;nbsp;and if your answer is yes then don&#39;t forget to&amp;nbsp;click &lt;strong&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Like &lt;/span&gt;&lt;/strong&gt;:-)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;br /&gt;
Many people have had asked me to share the solution. I have stored that in my SkyDrive so you can download it from here: &lt;a href=&quot;https://skydrive.live.com/redir?resid=B9F2D61015E21BDD!288&amp;amp;authkey=!ALkfaHZcNVgujxY&quot; target=&quot;_blank&quot;&gt;Dynamic Cube Partition&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Cheers!!!&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</description><link>http://sql-bi-dev.blogspot.com/2010/12/dynamic-cube-partitioning-in-ssas-2008.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQSFK9ifll5M2sy6Nb4EhSPSMLLx3mVaUhzqQznlC2Un6C2TldpFuRb4WByEE6_STArwgz5xKcu4vlT5s2ZQ8Gxx8XeBwqwhp8SWSWygXKUf_jXzFbUJ-zGcHU2b4ohqBw-mu8oHQ1311C/s72-c/DCP1.png" height="72" width="72"/><thr:total>66</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-6808011156253679538</guid><pubDate>Mon, 01 Nov 2010 17:03:00 +0000</pubDate><atom:updated>2010-11-01T10:04:30.717-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Convert Decimal to ROMAN using T-SQL</title><description>Do you want to convert a number into Roman Equivalent using T-SQL code or function? If yes then here you go:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;/**************************************************&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;CREATED BY : Hari Sharma&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;PURPOSE&amp;nbsp;&amp;nbsp;&amp;nbsp; : Convert Decimal&amp;nbsp;to ROMAN Equivalent&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;HOW TO USE : SELECT dbo.GetRomanNo(18)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --OUTPUT: XVIII&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;**************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE Function&lt;/span&gt; GetRomanNo(@N &lt;span style=&quot;color: blue;&quot;&gt;as varchar&lt;/span&gt;(20))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;RETURNS VARCHAR&lt;span style=&quot;color: black;&quot;&gt;(100)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;AS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; DECLARE &lt;span style=&quot;color: black;&quot;&gt;@s&lt;/span&gt; varchar&lt;/span&gt;(100), @r &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(100),&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @i &lt;span style=&quot;color: blue;&quot;&gt;bigint&lt;/span&gt;, @p &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;, @d &lt;span style=&quot;color: blue;&quot;&gt;bigint&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; SET&lt;/span&gt; @s = &lt;span style=&quot;color: red;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; SET&lt;/span&gt; @r = &lt;span style=&quot;color: red;&quot;&gt;&#39;IVXLCDM&#39;&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;-- Roman Symbols&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;/* There is no roman symbol for 0, but I don&#39;t &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; want &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;to return&amp;nbsp;an empty string */&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; IF&lt;/span&gt; @n=0 &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET &lt;/span&gt;@s = &lt;span style=&quot;color: red;&quot;&gt;&#39;0&#39;&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp; BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;SELECT&lt;/span&gt; @p = 1, @i = &lt;span style=&quot;color: magenta;&quot;&gt;ABS&lt;/span&gt;(@n)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHILE&lt;/span&gt;(@p&amp;lt;=5)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET&lt;/span&gt; @d = @i % 10&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; @i = @i / 10&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; @s = &lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; @d &lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt; (0,1,2,3) &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;Replicate&lt;/span&gt;(&lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p,1),@d) + @s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; @d &lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt; (4) &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p,2) + @s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; @d &lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt; (5,6,7,8) &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p+1,1) + &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;Replicate&lt;/span&gt;(&lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p,1),@d-5) + @s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; @d &lt;span style=&quot;color: blue;&quot;&gt;IN&lt;/span&gt; (9) &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p,1) + &lt;span style=&quot;color: magenta;&quot;&gt;SubString&lt;/span&gt;(@r,@p+2,1) + @s &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET &lt;/span&gt;@p = @p + 2 &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET&lt;/span&gt; @s = &lt;span style=&quot;color: magenta;&quot;&gt;Replicate&lt;/span&gt;(&lt;span style=&quot;color: red;&quot;&gt;&#39;M&#39;&lt;/span&gt;,@i) + @s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;IF&lt;/span&gt; @n &amp;lt; 0 &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; @s = &lt;span style=&quot;color: red;&quot;&gt;&#39;-&#39;&lt;/span&gt; + @s&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; RETURN &lt;span style=&quot;color: black;&quot;&gt;@s&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;GO&lt;/span&gt;</description><link>http://sql-bi-dev.blogspot.com/2010/11/do-you-want-to-convert-number-into.html</link><author>noreply@blogger.com (Hari Sharma)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-2073262379327009794</guid><pubDate>Thu, 28 Oct 2010 07:26:00 +0000</pubDate><atom:updated>2010-10-28T00:26:26.269-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>ExecutionValue and ExecValueVariable in SSIS</title><description>Have you ever used &lt;strong&gt;ExecutionValue&amp;nbsp;&lt;/strong&gt;and &lt;strong&gt;ExecValueVariable&lt;/strong&gt; in SSIS package?&lt;br /&gt;
&lt;br /&gt;
The ExecutionValue property&amp;nbsp;can be&amp;nbsp;defined on the object Task and&amp;nbsp;all tasks have this property. Its up to the developer to do something useful with this. The purpose of this&amp;nbsp;property&amp;nbsp;is to return something useful and interesting about what it has performed along with&amp;nbsp;standard success/failure result. &lt;br /&gt;
&lt;br /&gt;
The best example perhaps is the &lt;strong&gt;Execute SQL Task&lt;/strong&gt; which uses the &lt;strong&gt;ExecutionValue&lt;/strong&gt; property to return the number of rows affected by the SQL statement(s). This could be a useful feature which you may often want to capture into a variable and using the result to do something else. We cann&#39;t read the value of a task property at runtime from&amp;nbsp;SSIS but we can use ExecValueVariable to get it. &lt;br /&gt;
&lt;br /&gt;
The &lt;strong&gt;ExecValueVariable&lt;/strong&gt; property exposed through the task which lets us select a package variable. When the task sets the ExecutionValue, the actual value is copied into the variable we set on the ExecValueVariable property and a variable is something we can access and do something with. So if you are interested in ExecutionValue property&amp;nbsp; then make sure you create a package variable and set the name as the ExecValueVariable. &lt;br /&gt;
Below are the steps to implement this:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;STEP1:&lt;/strong&gt;&lt;br /&gt;
Create a new package and add below variable.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA-Lje-KNKVBmSqdTEm4uUHbolyGde2n5M5KY3oxEp2vepemgAMCh2GFwKhuxdp7sHeuf7CiJoshjN8tQ29zYgLLRPtpAkolRtfkiIlLZ21HHgWPXMhiSddBiIAiiH_cRHnp0YAy7bT3fh/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;91&quot; nx=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA-Lje-KNKVBmSqdTEm4uUHbolyGde2n5M5KY3oxEp2vepemgAMCh2GFwKhuxdp7sHeuf7CiJoshjN8tQ29zYgLLRPtpAkolRtfkiIlLZ21HHgWPXMhiSddBiIAiiH_cRHnp0YAy7bT3fh/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;strong&gt;STEP2:&lt;/strong&gt;&lt;br /&gt;
Drad and drop Execute SQL Task and set the properties as per your requirement. I am using below query in SQLStatement to&amp;nbsp;update Employee table:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;UPDATE&lt;/span&gt; [TestHN].dbo.Employee&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; [Basic] = [Basic]*2&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE &lt;/span&gt;[Basic] &amp;lt; 5000&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This query updates 4 records.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq7DQ3wh5v0Jg5kg3OhE9sexXQ-GMOOIr-WmW5gzURXe9u-Wl_fAiVm3ysDEL1QMH5EKLhtCGS7K5HCyv949TL7AcyWAj18zlR1xouXvv-1P_0r9UCUwKHUIDTYwb8_Ga1sxOAsVvxtEv9/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; nx=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq7DQ3wh5v0Jg5kg3OhE9sexXQ-GMOOIr-WmW5gzURXe9u-Wl_fAiVm3ysDEL1QMH5EKLhtCGS7K5HCyv949TL7AcyWAj18zlR1xouXvv-1P_0r9UCUwKHUIDTYwb8_Ga1sxOAsVvxtEv9/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
STEP3:&lt;br /&gt;
Set the &lt;strong&gt;ExecValueVariable &lt;/strong&gt;with User::ExecutionValue variable as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj597aT4LfQH-Gbbw0A7-cRuAJ9CrhvkafQaUUZJw3Ng-xk1oB2t5N8S_azcCDO766EWwCbErSwMYYQ19fSVpkL_-c-J1ECDXltxBIDP8sxZQEawWZEdj1EweQmFm_jKOk1BZHK0eIJb2W6/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;293&quot; nx=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj597aT4LfQH-Gbbw0A7-cRuAJ9CrhvkafQaUUZJw3Ng-xk1oB2t5N8S_azcCDO766EWwCbErSwMYYQ19fSVpkL_-c-J1ECDXltxBIDP8sxZQEawWZEdj1EweQmFm_jKOk1BZHK0eIJb2W6/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;STEP4:&lt;br /&gt;
Drag and drop Script Task to display the result of ExecValue variable. Now Execute the package.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTp0T9kNcCd1EsL5hYhzXPGYEW_QIntulNXh67TeWaz7ISdYrmVkbj9Y_mgeBanf5NMxwBR5WS4oeq0JMWS0cJROCFFhVM6dc4ROkhXPKGUBj5RXPc-WsB_LTDVqpxzScQgiokIVfIjHB/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;129&quot; nx=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTp0T9kNcCd1EsL5hYhzXPGYEW_QIntulNXh67TeWaz7ISdYrmVkbj9Y_mgeBanf5NMxwBR5WS4oeq0JMWS0cJROCFFhVM6dc4ROkhXPKGUBj5RXPc-WsB_LTDVqpxzScQgiokIVfIjHB/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Here is the list of few tasks that return something useful via the ExecutionValue and ExecValueVariable:&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Task&lt;/th&gt;&lt;th&gt;Description of ExecutionValue &lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Execute SQL Task&lt;/td&gt;&lt;td&gt;Returns the number of rows affected by the SQL statement(s).&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;File System Task&lt;/td&gt;&lt;td&gt;Returns the number of successful operations performed. &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;File Watcher Task&lt;/td&gt;&lt;td&gt;Returns the full path of the file found.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Transfer Jobs Task&lt;/td&gt;&lt;td&gt;Returns the number of jobs transferred &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Transfer Error Messages Task&lt;/td&gt;&lt;td&gt;Returns the number of error messages transferred. &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Transfer SQL Server Objects Task&lt;/td&gt;&lt;td&gt;Returns the number of objects transferred.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;</description><link>http://sql-bi-dev.blogspot.com/2010/10/executionvalue-and-execvaluevariable-in.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA-Lje-KNKVBmSqdTEm4uUHbolyGde2n5M5KY3oxEp2vepemgAMCh2GFwKhuxdp7sHeuf7CiJoshjN8tQ29zYgLLRPtpAkolRtfkiIlLZ21HHgWPXMhiSddBiIAiiH_cRHnp0YAy7bT3fh/s72-c/1.png" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-823416257742311802</guid><pubDate>Mon, 25 Oct 2010 07:01:00 +0000</pubDate><atom:updated>2010-10-25T00:01:05.607-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Track SQL Database Growth</title><description>In this article I am sharing a simple T-SQL code to track database growth for specific database. This could be a very simple query for SMEs but it can really help newbies:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;/*************************************************&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Purpose : Track Database Growth for a specific DB&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Create By : Hari Sharma&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;**************************************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; BackupDate = &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;(10),backup_start_date, 111) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; ,SizeInMBs=&lt;span style=&quot;color: magenta;&quot;&gt;FLOOR&lt;/span&gt;(backup_size/1024000) &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; msdb..backupset &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; database_name = &lt;span style=&quot;color: magenta;&quot;&gt;DB_NAME&lt;/span&gt;() &lt;span style=&quot;color: #38761d;&quot;&gt;--Specify DB Name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; AND &lt;span style=&quot;color: blue;&quot;&gt;type&lt;/span&gt; = &lt;span style=&quot;color: red;&quot;&gt;&#39;d&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER BY&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; backup_start_date &lt;span style=&quot;color: blue;&quot;&gt;desc&lt;/span&gt;&lt;/span&gt;</description><link>http://sql-bi-dev.blogspot.com/2010/10/track-sql-database-growth.html</link><author>noreply@blogger.com (Hari Sharma)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-3176760185242486544</guid><pubDate>Sun, 17 Oct 2010 09:10:00 +0000</pubDate><atom:updated>2010-10-17T02:10:38.836-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSRS</category><category domain="http://www.blogger.com/atom/ns#">SSRS Expressions</category><title>Displaying Dynamic Columns in SSRS Report</title><description>&lt;strong&gt;Problem&lt;/strong&gt;: How to display selected columns dynamically in SSRS reports. &lt;br /&gt;
&lt;strong&gt;Example&lt;/strong&gt;:&amp;nbsp;A report contains more than&amp;nbsp;30 fields. Some users want to see only 5 fields, some users 10 fields, and other may want to see 20 fields.&lt;br /&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Add a Report Parameter having the values as the name of all the fields of dataset. Now set hidden expression for each column of the tabular report.&lt;br /&gt;
&lt;br /&gt;
Here is the solution with an example:&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;STEP1: &lt;/strong&gt;&lt;br /&gt;
Create a report with required dataset. Drag and drop table control and select dataset fields. &lt;br /&gt;
In my example, I have following fields in the dataset: Year, Quarter, Month, Date, Product Name, Customer Name, Sales Region, Sales Country, Order Number, Sales Amount.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizqfhcsDSV6hMkqHOdUUopBGJCKpP-ymBM7WYmjFNNgEL43EcEe2e6qDn3ah9hSrxabRVp_em6A2k4hkMjHyj7v6vBLd2dOWotSUdXB3xd2ezUxyY1bsb3JD01KE10npF9D9pJt9RHJj6V/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;26&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizqfhcsDSV6hMkqHOdUUopBGJCKpP-ymBM7WYmjFNNgEL43EcEe2e6qDn3ah9hSrxabRVp_em6A2k4hkMjHyj7v6vBLd2dOWotSUdXB3xd2ezUxyY1bsb3JD01KE10npF9D9pJt9RHJj6V/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;strong&gt;STEP2:&lt;/strong&gt;&lt;br /&gt;
Create a&amp;nbsp;dataset &lt;strong&gt;dsColumns&lt;/strong&gt;&amp;nbsp;using below query:&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt; 1 ID, &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;Year&#39;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 2 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Quarter&#39;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 3 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Month&#39;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 4 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Date&#39;&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 5 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Product&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Name&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 6 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Customer&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Name&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 7 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Sales Region&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 8 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Sales Country&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 9 ID, &lt;span style=&quot;color: red;&quot;&gt;&#39;Order Number&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; ColumnName &lt;span style=&quot;color: blue;&quot;&gt;UNION&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 10 ID,&lt;span style=&quot;color: red;&quot;&gt;&#39;Sales Amount&#39; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS &lt;/span&gt;ColumnName&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
STEP3:&lt;br /&gt;
Create a new parameter&amp;nbsp;with name&amp;nbsp;&lt;strong&gt;pDisplayFields&lt;/strong&gt; and Promt &lt;strong&gt;Display Columns&lt;/strong&gt; as shown below:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0IYjBisb9EwStr7iAg3oi3KOoSx0de0DEqItDujHg6ml0vXmoMx7cowTH9As6lYT5bKElrYasd359jHqIMInH3suIdzKOgR6h6onumb869SxRwYHgcoNb6srsnCS__fl0Os99UVOPq7vr/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;263&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0IYjBisb9EwStr7iAg3oi3KOoSx0de0DEqItDujHg6ml0vXmoMx7cowTH9As6lYT5bKElrYasd359jHqIMInH3suIdzKOgR6h6onumb869SxRwYHgcoNb6srsnCS__fl0Os99UVOPq7vr/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;In &lt;strong&gt;Available Values&lt;/strong&gt; of &lt;em&gt;Report Parameter Properties&lt;/em&gt; wizard, select &lt;strong&gt;Get values from a query&lt;/strong&gt;, select &lt;strong&gt;dsColumns&lt;/strong&gt; in Dataset, &lt;strong&gt;ColumName&lt;/strong&gt; in value field and label field.&lt;br /&gt;
&lt;br /&gt;
In &lt;strong&gt;Default Values&lt;/strong&gt; of &lt;em&gt;Report Parameter Properties&lt;/em&gt; wizard, select &lt;strong&gt;Get values from a query&lt;/strong&gt;, select &lt;strong&gt;dsColumns&lt;/strong&gt; in Dataset, &lt;strong&gt;ColumName&lt;/strong&gt; in value field.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;STEP4:&lt;/strong&gt;&lt;br /&gt;
Now you have to set the expression to display the colummns which are selected in the &lt;strong&gt;pDisplayColumn &lt;/strong&gt;parameter. Right click on First Column (&lt;strong&gt;Year&lt;/strong&gt; in my example) and click &lt;strong&gt;Column Visibility&lt;/strong&gt;...&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiErTFOPM2WyU49sfmO7LnGoPgGIFTIBiHQ_0_hEqNVlLuQRrts4SgRdnOXPQguA_Q75Mr3CXlb4qDvbsSZJAN4uMjGDNqGxEfbkp9XalWfe73nqmm6Yfh5Su-jbUURMEaerCFLDvojsCsH/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiErTFOPM2WyU49sfmO7LnGoPgGIFTIBiHQ_0_hEqNVlLuQRrts4SgRdnOXPQguA_Q75Mr3CXlb4qDvbsSZJAN4uMjGDNqGxEfbkp9XalWfe73nqmm6Yfh5Su-jbUURMEaerCFLDvojsCsH/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Write following expression in &lt;strong&gt;Show or hide based on an expression&lt;/strong&gt; of &lt;em&gt;Column Visibility&lt;/em&gt; wizard:&lt;br /&gt;
&lt;span style=&quot;background-color: #cfe2f3; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;=IIF(InStr(JOIN(Parameters!pDisplayFields.Value,&lt;span style=&quot;color: #990000;&quot;&gt;&quot;,&quot;&lt;/span&gt;),&lt;span style=&quot;color: #990000;&quot;&gt;&quot;Year&quot;&lt;/span&gt;)&amp;gt;0,&lt;span style=&quot;color: blue;&quot;&gt;False&lt;/span&gt;,&lt;span style=&quot;color: blue;&quot;&gt;True&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now repeat this expression for all the columns by modify the expression for the respective column name accordingly.&lt;br /&gt;
&lt;br /&gt;
Thats all. Now preview the report. You will see all the columns by default.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYuYT-weJeT3R1-Wgfmutl-0CBQUN-dAMRKR9I2zdl0jVoYK-uMpDjYVDO5OFF7dDFT7tBQEtEa9u38i18dQQ-UL-3D_9MOsDD-LmaFq4rzKfqfSmKvLwkrdqD_Q6ho5mLUDQ35yEzeJN2/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;167&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYuYT-weJeT3R1-Wgfmutl-0CBQUN-dAMRKR9I2zdl0jVoYK-uMpDjYVDO5OFF7dDFT7tBQEtEa9u38i18dQQ-UL-3D_9MOsDD-LmaFq4rzKfqfSmKvLwkrdqD_Q6ho5mLUDQ35yEzeJN2/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Now select required columns in &lt;strong&gt;Display Column&lt;/strong&gt; parameter to modify the report layout at run time.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4zHPPAzrpps3GqALHGVSs_E0gPMZIC3vSO-NS-ffkZK4R2DnNc_l546xJyK5cXRYAfx7azQcushHUCZM000C7HicZYXypVdnZ8daytip8sl2zEgzyfVIxPues4p_ydsZoJO2B_ZVMw5Xe/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4zHPPAzrpps3GqALHGVSs_E0gPMZIC3vSO-NS-ffkZK4R2DnNc_l546xJyK5cXRYAfx7azQcushHUCZM000C7HicZYXypVdnZ8daytip8sl2zEgzyfVIxPues4p_ydsZoJO2B_ZVMw5Xe/s320/1.png&quot; width=&quot;237&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Cheers!!!</description><link>http://sql-bi-dev.blogspot.com/2010/10/displaying-dynamic-columns-in-ssrs.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizqfhcsDSV6hMkqHOdUUopBGJCKpP-ymBM7WYmjFNNgEL43EcEe2e6qDn3ah9hSrxabRVp_em6A2k4hkMjHyj7v6vBLd2dOWotSUdXB3xd2ezUxyY1bsb3JD01KE10npF9D9pJt9RHJj6V/s72-c/1.png" height="72" width="72"/><thr:total>35</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-2602644927924713798</guid><pubDate>Wed, 13 Oct 2010 06:14:00 +0000</pubDate><atom:updated>2010-10-12T23:14:29.584-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>Creating SSIS Template Package</title><description>&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: inherit; font-size: 11pt; mso-ansi-language: EN-IN; mso-bidi-font-size: 12.0pt;&quot;&gt;One of the most desired feature in SSIS packages development is re-usability. Being a developer, you may need standard packages that can be re-used during different ETL development. In SSIS, this can be easily achieved using template features. SSIS &lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;template packages&lt;/b&gt; are the re-usable packages that one can use in any SSIS project any number of times.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span lang=&quot;EN-IN&quot; style=&quot;font-family: inherit; line-height: 115%; mso-ansi-language: EN-IN; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;You can reuse these items when you use a package template to create a new package. You may want to reuse the following items in a package template:&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Connection Managers &lt;/strong&gt;and &lt;strong&gt;Log Providers&lt;/strong&gt;: Log Provider is common thing in almost all the packages. You can create a package that includes a connection manager and a log provider. You can also use that package as a template for other packages. &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common Variables &lt;/strong&gt;and &lt;strong&gt;Configurations&lt;/strong&gt;: In most of the packages you may use common variables and same configurations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Event Handlers&lt;/strong&gt;: You may need to use same event handlers or error handling across ETL packages in a project.&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;strong&gt;Send Mail tasks&lt;/strong&gt;: You can create a package that contains an SMTP connection manager, a Send Mail task, and a property expression to build the Subject line. Use this package as a template to create other packages that notify you by e-mail when the package runs successfully or generates an error.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common Task&lt;/strong&gt;: I have seen many projects where many tasks are common across 70% packages e.g. Execute SQL Task, Data Flow elements, and Control Flow elements.&amp;nbsp;It&amp;nbsp;may differ project to project but its always good idea to encapsulate the common task in a tamplate and use it wherever required.&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #548dd4; font-family: &amp;quot;Verdana&amp;quot;, &amp;quot;sans-serif&amp;quot;; mso-themecolor: text2; mso-themetint: 153;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;How to create SSIS Template Package&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Below are the steps to create a new package template in SQL Server Business Intelligence Development Studio:&lt;br /&gt;
1. Start SQL Server Business Intelligence Development Studio. Click &lt;strong&gt;File&lt;/strong&gt;, point to &lt;strong&gt;New&lt;/strong&gt;, and then click &lt;strong&gt;Project&lt;/strong&gt;.&lt;br /&gt;
2. In the &lt;strong&gt;New Project&lt;/strong&gt; window, click &lt;em&gt;Business Intelligence Projects&lt;/em&gt;, and then&amp;nbsp;click &lt;em&gt;Integration Services Project &lt;/em&gt;under Visual Studio installed templates, type a name for the project, and then click OK.&lt;br /&gt;
&lt;br /&gt;
3. Add the items that you want from the Toolbox to the Package.dtsx file. Once you are done with pachake template development, Click &lt;strong&gt;File&lt;/strong&gt;, and then click &lt;strong&gt;Save Selected Items&lt;/strong&gt;.&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt;: Give a package name that describes the functionality of the package.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
4. Click File, and then click &lt;strong&gt;Save Copy of&amp;nbsp;&lt;span style=&quot;color: #073763;&quot;&gt;PackageName&lt;/span&gt; As&lt;/strong&gt;. Here filename is the name of package.&lt;br /&gt;
In the &lt;strong&gt;Save Copy of Package&lt;/strong&gt; dialog box, click &lt;strong&gt;File System&lt;/strong&gt; in the &lt;strong&gt;Package location&lt;/strong&gt; box, type the following path in the &lt;strong&gt;Package path&lt;/strong&gt; box, and then click OK. In this path, drive is the hard disk where Microsoft Visual Studio is installed:&lt;br /&gt;
&lt;em&gt;&lt;strong&gt;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\ProjectItems\DataTransformationProject\DataTransformationItems&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #660000;&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;Type the path of the Visual Studio 2005 folder in the Package path box in case you didn&#39;t use the default location to install Visual Studio.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;How to use the Package template in other Project or Solution&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
1. Start SQL Server Business Intelligence Development Studio. Click &lt;strong&gt;File&lt;/strong&gt;, point to &lt;strong&gt;New&lt;/strong&gt;, and then click &lt;strong&gt;Project&lt;/strong&gt;.&lt;br /&gt;
2. In the &lt;strong&gt;New Project&lt;/strong&gt; window, click &lt;em&gt;Business Intelligence Projects&lt;/em&gt;, and then&amp;nbsp;click &lt;em&gt;Integration Services Project &lt;/em&gt;under Visual Studio installed templates, type a name for the project, and then click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;3. In Soultion Explorer, right click on Project name, click on &lt;strong&gt;Add&lt;/strong&gt; and then &lt;strong&gt;New Item&lt;/strong&gt;... Under &lt;strong&gt;Visual Studio installed templates&lt;/strong&gt;, click the template that you want, type a name for the template, and then click Add. In the below screen-shot, MyPkgTemplate is a template I saved in my system.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3n6qr-MC5_r3myJUAfeVtgyiZ05VH45aV0UqGyfbzgkAtVAjHvnOVIWKR5IUOMujaJROV-Zv1uxuvJUU1FuVqvBnxwX60e4alughNDUzRBwN0t8uMRN-5GaCNaM2g7XCHZwotFD2YDx-p/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; ex=&quot;true&quot; height=&quot;145&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3n6qr-MC5_r3myJUAfeVtgyiZ05VH45aV0UqGyfbzgkAtVAjHvnOVIWKR5IUOMujaJROV-Zv1uxuvJUU1FuVqvBnxwX60e4alughNDUzRBwN0t8uMRN-5GaCNaM2g7XCHZwotFD2YDx-p/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;strong&gt;Note: &lt;/strong&gt;The default name for the template in the Name box is the name of the template plus an incremented counter. For example, if the template name is MyPkgTemplate.dtsx, the default name is MyPkgTemplate1.dtsx.</description><link>http://sql-bi-dev.blogspot.com/2010/10/creating-ssis-template-package.html</link><author>noreply@blogger.com (Hari Sharma)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3n6qr-MC5_r3myJUAfeVtgyiZ05VH45aV0UqGyfbzgkAtVAjHvnOVIWKR5IUOMujaJROV-Zv1uxuvJUU1FuVqvBnxwX60e4alughNDUzRBwN0t8uMRN-5GaCNaM2g7XCHZwotFD2YDx-p/s72-c/1.png" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7924929528826389309.post-8625108927528378318</guid><pubDate>Wed, 06 Oct 2010 21:17:00 +0000</pubDate><atom:updated>2010-10-06T14:17:38.502-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SSAS</category><title>Dimension Design Best Practices</title><description>Good Dimension design is the most important aspect of a well designed OLAP database. Although the wizards in SSAS do much of the work to get you started, it&#39;s important to review the design that is created by the wizard and ensure that the &lt;u&gt;attributes, relationships, and hierarchies&lt;/u&gt; correctly reflect the data and match the needs of end-users.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #20124d;&quot;&gt;Here are the Dimension Design Best Practices:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Create attribute relationships wherever possible&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Attribute relationships are an important part of dimension design.&amp;nbsp;&amp;nbsp;They help the server optimize storage of data, define referential integrity rules within the dimension, control the presence of member properties, and determine how MDX restrictions on one hierarchy affect the values in another hierarchy.&amp;nbsp;&amp;nbsp;For these reasons, it is important to spend some time defining attribute relationships that accurately reflect relationships in the data.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid creating unnecessary attributes&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;Attributes add to the complexity and storage requirements of a dimension, and the number of attributes in a dimension can significantly affect performance. This is especially of attributes which have &lt;strong&gt;AttributeHierachyEnabled&lt;/strong&gt; set to &lt;strong&gt;True&lt;/strong&gt;. Although SSAS can support many attributes in a dimension but&amp;nbsp;having more attributes decreases performance unnecessarily and can make the end-user experience difficult.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Use numeric keys for attributes that contain many members (&amp;gt;1 million)&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Using a numeric key column instead of a string key column / composite key will improve the performance of attributes that contain many members. This best practice is based on the same concept as using surrogate keys in relational tables for more efficient indexing. You can specify the numeric surrogate column as the key column and still use a string column as the name column so that the attribute members appear the same to end-users. As a guideline, if the attribute has more than one million members, you should consider using a numeric key.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Don&#39;t create hierarchies where an attribute of a lower level contains fewer members than an attribute of the level above&lt;/span&gt;&lt;/strong&gt; &lt;br /&gt;
A hierarchy such as this is frequently an indication that your levels are in the incorrect order: for example, [State] above [Country]. It might also indicate that the key columns of the lower level are missing a column: for example, [Year] above [Quarter] instead of [Year] above [Year-Quarter]. Either of these situations will lead to confusion for end-users trying to use and understand the cube. &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Don&#39;t include multiple non-aggregatable attributes per dimension&lt;/span&gt;&lt;/strong&gt; &lt;br /&gt;
Because there is no All member, each non-aggregatable attribute will always have some non-all member selected, even if not specified in a query. Therefore, if you include multiple non-aggregatable attributes in a dimension, the selected attributes will conflict and produce unexpected numbers. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Use key columns that completely define the uniqueness of the members in an attribute&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Usually a single key column is sufficient, but sometimes multiple key columns are necessary to uniquely identify members of an attribute. For example, it is common in time dimensions to have a [Month] attribute include both [Year] and [Month] as key columns. This is known as a composite key and identifies January of 2009 as being a different member than January of 2010. When you use [Month] in a time hierarchy that also contains [Year] so&amp;nbsp;this distinction between January of 2009 and January of 2010 is important.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Do perform Process Index after doing a Process Update if the dimension contains flexible AttributeRelationships or a parent-child hierarchy&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
An aggregation is considered flexible if any attribute included in the aggregation is related, either directly or indirectly, to the key of its dimension through an AttributeRelationship with RelationshipType set to Flexible. Aggregations that include parent-child hierarchies are also considered flexible.&lt;br /&gt;
&lt;br /&gt;
When a dimension is processed by using the &lt;strong&gt;Process Update&lt;/strong&gt; option, any flexible aggregations that the dimension participates in might be dropped, depending on the contents of the new dimension data. These aggregations are not rebuilt by default, so Process Index must then be explicitly performed to rebuild them.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Don&#39;t create redundant attribute relationships&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Do not create attribute relationships that are transitively implied by other attribute relationships. The alternative paths created by these redundant attribute relationships can cause problems for the server and are of no benefit to the dimension. For example, if the relationships A-&amp;gt;B, B-&amp;gt;C, and A-&amp;gt;C have been created, A-&amp;gt;C is redundant and should be removed.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Do include the key columns of snowflake tables joined to nullable foreign keys as attributes that have NullProcessing set to UnknownMember&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
If tables that are used in a dimension are joined on a foreign key column that might contain nulls, it is important that you include in your design an attribute whose key column is the corresponding key in the lookup table. Without such an attribute, the OLAP server would have to issue a query to join the two tables during dimension processing. This makes processing slower; moreover, the default join that is created by the OLAP server would exclude any rows that contain nulls in the foreign key column. It is important to set the &lt;strong&gt;NullProcessing&lt;/strong&gt; option on the key column of this attribute to &lt;strong&gt;UnknownMember&lt;/strong&gt;. The reason is that, by default, nulls are converted to zeros or blanks when the engine processes attributes. This can be dangerous when you are processing a nullable foreign key. Conversion of a null to zero at best produces an error; in the worst case, the zero may be a legitimate value in the lookup table, thereby producing incorrect results.&lt;br /&gt;
&lt;br /&gt;
To handle nullable foreign keys correctly, you must also set &lt;strong&gt;UnknownMember&lt;/strong&gt; to &lt;strong&gt;Visible&lt;/strong&gt; on the dimension. The Cube Wizard and Dimension Wizard currently set this property automatically; however, the Dimension Wizard lets you manually de-select the key attribute of snowflake tables. You must not deselect the key column if the corresponding foreign key is nullable.&lt;br /&gt;
&lt;br /&gt;
If you do not want to browse the attribute that contains the lookup table key column, you can set &lt;strong&gt;AttributeHierarchyVisible&lt;/strong&gt; to &lt;strong&gt;False&lt;/strong&gt;. However, &lt;strong&gt;AttributeHierarchyEnabled&lt;/strong&gt; must be set to &lt;strong&gt;True&lt;/strong&gt; because it is necessary that all other attributes in the lookup table be directly or indirectly related to the lookup key attribute in order to avoid the automatic creation of new joins during dimension processing.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;Note: You can also create a new record in look table (e.g. -1 as surrogate key) for NULL references.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Set RelationshipType property appropriately on AttributeRelationships based on whether the relationships between individual members change over time&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
The relationships between members of some attributes, such as dates in a given month or the gender of a customer, are not expected to change. Other relationships, such as SalesPeople in a given region or the Marital Status of a customer, are more prone to change over time. You should set &lt;strong&gt;RelationshipType&lt;/strong&gt; to &lt;strong&gt;Flexible&lt;/strong&gt; for those relationships that are expected to change and set &lt;strong&gt;RelationshipType&lt;/strong&gt; to &lt;strong&gt;Rigid&lt;/strong&gt; for relationships that are not expected to change. When you set RelationshipType appropriately, the server can optimize the processing of changes and re-building of aggregations.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid using ErrorConfigurations with KeyDuplicate set to IgnoreError on dimensions&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
When KeyDuplicate is set to IgnoreError, it can be difficult to detect problems with incorrect key columns, incorrectly defined AttributeRelationships, and data consistency issues. Instead of using the IgnoreError option, in most cases it is better to correct your design and clean the data. The IgnoreError option may be useful in prototypes where correctness is less of a concern.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Consider creating user-defined hierarchies whenever you have a chain of related attributes in a dimension&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Chains of related attributes usually represent an interesting navigation path for end-users, and defining hierarchies for these will also provide performance benefits.&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid creating user-defined hierarchies that do not have attribute relationships relating each level to the level above&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Having attribute relationships between every level in a hierarchy makes the hierarchy strong and enables significant server optimizations.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid creating diamond-shaped attribute relationships&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
A Diamond-shaped relationship refers to a chain of attribute relationships that splits and rejoins but contains no redundant relationships. For example, Day-&amp;gt;Month-&amp;gt;Year and Day-&amp;gt;Quarter-&amp;gt;Year have the same start and end points, but do not have any common relationships. The presence of multiple paths can create some ambiguity on the server. If preserving the multiple paths is important, it is strongly recommended that you resolve the ambiguity by creating user hierarchies that contain all the paths.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Consider setting AttributeHierarchyEnabled to False on attributes that have cardinality that closely matches the key attribute&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
When an attribute contains roughly one value for each distinct value of the key attribute, it usually means that the attribute contains only alternative identification information or secondary details. Such attributes are usually not interesting to pivot or group by. For example, the Social Security number or telephone number may be interesting properties to view, but there is very little value in being able to pivot and group based on SSN or telephone. Setting AttributeHierarchyEnabled to False on such attributes will reduce the complexity of the dimension for end-users and improve its performance.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Consider setting AttributeHierarchyVisible to False on the key attribute of parent-child dimensions&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Because the members of the key attribute are also contained in the parent-child hierarchy in a more organized manner, it is usually unnecessary and confusing to the end-user to expose the flat list of members contained in the key attribute.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid setting UnknownMember=Hidden&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
When you suppress unknown members, the effect is to hide relational integrity issues; moreover, because hidden members might contain data, results might appear not to add up. Therefore, we recommend that you avoid use of this setting except in prototype applications.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Use MOLAP storage mode for dimensions with outline calculations&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Dimensions that contain custom rollups&lt;span style=&quot;color: black;&quot;&gt;, semi-additive measures, and unary operators &lt;/span&gt;will perform significantly better using MOLAP storage. The following dimension types will also benefit from using MOLAP storage: an Account dimension in a measure group that contains measures aggregated using ByAccount; the first time dimension in a measure group that contains other semi-additive measures.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Use a 64 bit server if you have dimensions with more than 10 million members.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
If a dimension contains more than 10 million members, using an x64 or an IA-64-based server is recommended for better performance.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Set the OrderBy property for time attributes and other attributes whose natural ordering is not alphabetical&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
By default, the server orders attribute members alphabetically, by name. This ordering is especially undesirable for time attributes. To obtain the desired ordering, use the &lt;strong&gt;OrderBy&lt;/strong&gt; and &lt;strong&gt;OrderByAttributes&lt;/strong&gt; properties and explicitly specify how you want the members ordered. For time-based attributes, there is frequently a date or numeric key column that can be used to obtain the correct chronological ordering.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Expose a DateTime MemberValue for date attributes&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Some clients, such as Excel, will take advantage of the MemberValue property of date members and use the DateTime value that is exposed. When Excel recognizes the value as DateTime, Excel can treat the value as a date type and apply date functions to the value, as well as provide better formatting and filtering. If the key column is a single DateTime column and the name column has not been set, this MemberValue is automatically derived from the key column and no action is necessary.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid setting IsAggregatable to False on any attribute other than the parent attribute in a parent-child dimension&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
Non-aggregatable attributes have non-all default members. These default members affect the result of queries whenever the attributes are not explicitly included. Because parent-child hierarchies generally represent the most interesting exploration path in dimensions that contain them, it is best to avoid having non-aggregatable attributes other than the parent attribute.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Do not combine unrelated business entities into a single dimension&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;div&gt;Combining attributes of independent business entities, such as customer and product or warehouse and time, into a single dimension will not only create a confusing model, but also reduce query performance because auto-exist will be applied across attributes within the dimension.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Another way to state this rule is that the values of the key attribute of a dimension should uniquely identify a single business entity and not a combination of entities. Generally this means having a single column key for the key attribute.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Consider setting AttributeHierarchyVisible to False for attributes included in user-defined hierarchies&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;It is usually not necessary to expose an attribute in its own single level hierarchy when that attribute is included in a user-defined hierarchy. This duplication only complicates the end-user experience without providing additional value.&lt;/div&gt;&lt;div&gt;One common case in which it is appropriate to present two views of an attribute is in time dimensions. The ability to browse by [Month] and the ability to browse by [Month-Quarter-Year] are both very valuable. However, these two month attributes are actually separate attributes. The first contains only the month value such as “January” while the second contains the month and the year such as “January 2010”.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Avoid making an attribute non-aggregatable unless it is at the end of the longest chain of attribute relationships in the dimension&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Non-aggregatable attributes have non-all default members that affect the result of queries in which values for those attributes are not explicitly specified. Therefore, you should avoid making an attribute non-aggregatable unless that attribute is regularly used. Because the longest chain of attributes generally represents the most interesting exploration path for users, it is best to avoid having non-aggregatable attributes in other, less interesting chains.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #4c1130;&quot;&gt;Consider creating at least one user-defined hierarchy in each dimension that does not contain a parent-child hierarchy&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Most (but not all) dimensions contain some hierarchical structure to the data which is worth exposing in the cube. Frequently the Cube Wizard or Dimension Wizard will not detect this hierarchy. In these cases, you should define a hierarchy manually.&lt;/div&gt;</description><link>http://sql-bi-dev.blogspot.com/2010/10/dimension-design-best-practices.html</link><author>noreply@blogger.com (Hari Sharma)</author><thr:total>2</thr:total></item></channel></rss>