<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1320476894466593706</atom:id><lastBuildDate>Fri, 24 Jul 2026 06:05:36 +0000</lastBuildDate><category>MyTechnoBook</category><category>-- All Blog Posts --</category><category>SSRS</category><category>T-SQL</category><category>Code Snippets</category><category>SSMS</category><category>Windows</category><category>Humour</category><category>SSIS</category><category>Tools</category><category>BIDS</category><category>Denali</category><category>Issues N Resolution</category><category>Best Practices</category><category>General</category><category>Interview</category><category>PPS-MOSS</category><category>Shortcuts</category><category>About Me</category><category>SSAS</category><category>TFS</category><category>Videos</category><title>MyTechnoBook</title><description>Datta's Technical Notes..!!</description><link>http://mytechnobook.blogspot.com/</link><managingEditor>noreply@blogger.com (Unknown)</managingEditor><generator>Blogger</generator><openSearch:totalResults>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-4342292300550140447</guid><pubDate>Tue, 30 Nov 2010 17:59:00 +0000</pubDate><atom:updated>2010-11-30T23:29:56.951+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Denali</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSMS</category><title>Zoom Query Surface in SSMS in Denali</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;SQL Server Management Studio (SSMS) in Denali (CTP1) has got a makeover and is now based on Visual Studio 2010 Shell. This will enable us to utilize lot of great features available in Visual Studio like Improved Intellisense, Dragging Query/Code Window to a different monitor etc.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Ad2NFdaCYHI6g4vq2uubqZQsZxzIKXxLNN75Zn3ZJOrjXiH3i8XLD82blbpbuXlHNt1zhYWXWVNUloWvYSD2u0GF4JXP6_gcUjPlY8aeu_NuWsQ_REHXSoiA5FVnbq-nmnG7nSTkeNPp/s1600/Denali+-+SSMS+-+SSMSBasedOnVisualStudioNutshell.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Ad2NFdaCYHI6g4vq2uubqZQsZxzIKXxLNN75Zn3ZJOrjXiH3i8XLD82blbpbuXlHNt1zhYWXWVNUloWvYSD2u0GF4JXP6_gcUjPlY8aeu_NuWsQ_REHXSoiA5FVnbq-nmnG7nSTkeNPp/s1600/Denali+-+SSMS+-+SSMSBasedOnVisualStudioNutshell.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;Another interesting feature introduced in SSMS in Denali CTP1 is the ability to zoom the query/design surface which will enable you to have a bigger size font for your queries and making your experience close to having a bigger size desktop/monitor.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Below is a normal query window with Normal or 100% Zooming.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSrYNCUlW9RhmtBbmJPWB-MBzojhs76DWN9M_SNXXmoDPV0u-mbQXT_cak54tlnAIHwuI1ZSEBMp_DPE7vZuZ2D8QR-Txdr74AN3B-O3UP2YbJ2lJIhCka20UF7yY9dQE9eVCI4hoLC9bF/s1600/Denali+-+SSMS+-+ZoomQuerySurface+-+1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSrYNCUlW9RhmtBbmJPWB-MBzojhs76DWN9M_SNXXmoDPV0u-mbQXT_cak54tlnAIHwuI1ZSEBMp_DPE7vZuZ2D8QR-Txdr74AN3B-O3UP2YbJ2lJIhCka20UF7yY9dQE9eVCI4hoLC9bF/s1600/Denali+-+SSMS+-+ZoomQuerySurface+-+1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;As you can see there is an option at the &lt;strong&gt;Left Bottom Corner&lt;/strong&gt; to &lt;strong&gt;Zoom&lt;/strong&gt; the &lt;strong&gt;Query/Design Surface&lt;/strong&gt;. Now if we change the Zoom Level to 150% then the Query Window looks something like the one shown below.&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjafLyw4mgxLCoryDDcj7RFeJyQJeSWH4F0jEtkocnWPc1YcuXgk2pCmDzO9ULXBu7wi0wPO4wA4WipGpogJgudGrI6rhaAU1dvlS1IrEuBIQ40MUhseUUEJWDGUNp77C6D-E9n29f6CnVD/s1600/Denali+-+SSMS+-+ZoomQuerySurface+-+2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjafLyw4mgxLCoryDDcj7RFeJyQJeSWH4F0jEtkocnWPc1YcuXgk2pCmDzO9ULXBu7wi0wPO4wA4WipGpogJgudGrI6rhaAU1dvlS1IrEuBIQ40MUhseUUEJWDGUNp77C6D-E9n29f6CnVD/s1600/Denali+-+SSMS+-+ZoomQuerySurface+-+2.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;As you can see now when we changed the Zoom Level to 150%, we are getting bigger font for our query there by giving us an experience similar to having a bigger size desktop/monitor.&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;Also, note that the Zoom Level is applied only to the Query/Design Surface and is not applied to any other areas like Results Pane, Object Explorer etc.&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;There are many more such cool features introduced in Denali CTP1. So stay tuned to learn more new things about Denali CTP1.&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/zoom-query-surface-in-ssms-in-denali.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Ad2NFdaCYHI6g4vq2uubqZQsZxzIKXxLNN75Zn3ZJOrjXiH3i8XLD82blbpbuXlHNt1zhYWXWVNUloWvYSD2u0GF4JXP6_gcUjPlY8aeu_NuWsQ_REHXSoiA5FVnbq-nmnG7nSTkeNPp/s72-c/Denali+-+SSMS+-+SSMSBasedOnVisualStudioNutshell.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-5836231259561149028</guid><pubDate>Mon, 29 Nov 2010 19:44:00 +0000</pubDate><atom:updated>2010-11-30T23:40:27.820+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">BIDS</category><category domain="http://www.blogger.com/atom/ns#">Denali</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><title>Zoom BIDS Package Design Surface in SSIS in Denali</title><description>&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;SSIS in Denali comes with a whole bunch of new and exciting features both from an arthitectural/development standpoint and also from a usability standpoint. Here is a really cool feature introduced in Denali Business Intelligence Development Studio (BIDS) for SSIS which allows us to Zoom only the Package Design Surface which will help in navigating easily in the designer especially while developing some really huge packages.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Below is a screenshot of a sample package in the normal 100% zoom mode (default).&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6JwdY7cv084EFrCdMQ8dphBTCsWq0pTF1FVvPIlFvgy7Fw9mH3p7ETV_k_yudqAbf51FDjauohBooeM856w9SzP9SISPS1QepFIVSUUagR-4awIVt8OXm7RALRKrLcsyvYaqe-WGa-o5N/s1600/Denali+-+BIDS+-+SSIS+-+Zoom+Design+Surface+-+1.png" imageanchor="1" style="cssfloat: left; margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="470" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6JwdY7cv084EFrCdMQ8dphBTCsWq0pTF1FVvPIlFvgy7Fw9mH3p7ETV_k_yudqAbf51FDjauohBooeM856w9SzP9SISPS1QepFIVSUUagR-4awIVt8OXm7RALRKrLcsyvYaqe-WGa-o5N/s400/Denali+-+BIDS+-+SSIS+-+Zoom+Design+Surface+-+1.png" width="570" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div align="left" style="text-align: justify;"&gt;Now we can use the slider located on the &lt;strong&gt;bottom right corner&lt;/strong&gt; of the designer surface&amp;nbsp;to zoom the design surface to see larger size images of various tasks/components within the design surface as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-4fE185yS56sDRmyjowSsG9j8F2GNpGr3OcXoCCArMsoRFTr4XTdwdNEWrkR0k_4COLHpdvhZ7TXWuZt_bcENByyE7s5Axv3dCpO_RLxoYi8L3EY16BHFVIZfDZHo83haa8pj6dPQJ_-Y/s1600/Denali+-+BIDS+-+SSIS+-+Zoom+Design+Surface+-+2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="473" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-4fE185yS56sDRmyjowSsG9j8F2GNpGr3OcXoCCArMsoRFTr4XTdwdNEWrkR0k_4COLHpdvhZ7TXWuZt_bcENByyE7s5Axv3dCpO_RLxoYi8L3EY16BHFVIZfDZHo83haa8pj6dPQJ_-Y/s320/Denali+-+BIDS+-+SSIS+-+Zoom+Design+Surface+-+2.png" width="570" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Note that the Zooming is applied only to the design surface and not to any other area like Connection Managers tray, Solution Explorer etc.&lt;br /&gt;
There are lot more usability enhancements introduced in Denali which I will post in the coming days. So stay tuned!&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/zoom-bids-package-design-surface-in.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6JwdY7cv084EFrCdMQ8dphBTCsWq0pTF1FVvPIlFvgy7Fw9mH3p7ETV_k_yudqAbf51FDjauohBooeM856w9SzP9SISPS1QepFIVSUUagR-4awIVt8OXm7RALRKrLcsyvYaqe-WGa-o5N/s72-c/Denali+-+BIDS+-+SSIS+-+Zoom+Design+Surface+-+1.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-5973115129898502704</guid><pubDate>Mon, 29 Nov 2010 18:41:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.960+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Denali</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><title>What's New in Denali</title><description>&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;The&amp;nbsp;Next Version&amp;nbsp;of SQL Server codenamed &lt;strong&gt;Denali&lt;/strong&gt; has been released to the community (CTP1) just a couple of weeks back&amp;nbsp;for evaluation &amp;amp; feedback. I am very much excited about the CTP1 release of the next version of SQL Server and have already started looking into some of the interesting improvements made in &lt;strong&gt;Denali&lt;/strong&gt;. In the next few weeks I will be posting some new and interesting features of &lt;strong&gt;Denali&lt;/strong&gt; and also my experience with &lt;strong&gt;Denali&lt;/strong&gt;. So keep visiting this blog for more interesting stuff on &lt;strong&gt;Denali&lt;/strong&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;In the mean time, I encourage those of you interested in Denali to go over the following links:&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/sql-server-code-named-quot-denali-quot-ctp1-release-notes.aspx"&gt;SQL Server Code-Named "Denali" CTP1 Release Notes&lt;/a&gt; (TechNet)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms143506(SQL.110).aspx"&gt;Hardware and Software Requirements for Installing SQL Server "Denali"&lt;/a&gt; (MSDN)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/bb500429(SQL.110).aspx"&gt;Discontinued Integration Services Functionality in SQL Server "Denali"&lt;/a&gt; (TechNet)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://technet.microsoft.com/en-us/library/ms403408(SQL.110).aspx"&gt;Deprecated Integration Services Features in SQL Server "Denali"&lt;/a&gt; (TechNet)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms144262(v=SQL.110).aspx"&gt;Discontinued Database Engine Functionality in SQL Server "Denali"&lt;/a&gt; (MSDN)&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms143729(SQL.110).aspx"&gt;Deprecated Database Engine Features in SQL Server "Denali"&lt;/a&gt; (MSDN)&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;You can download the &lt;strong&gt;Denali CTP1&lt;/strong&gt; from &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6a04f16f-f6be-4f92-9c92-f7e5677d91f9&amp;amp;displaylang=en"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;strong&gt;&lt;u&gt;Note&lt;/u&gt;&lt;/strong&gt;: It is highly recommended that you read through the &lt;strong&gt;Release Notes&lt;/strong&gt; and &lt;strong&gt;Hardware &amp;amp; Software Requirements for Installing SQL Server "Denali"&lt;/strong&gt; before proceeding with the installation!&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/whats-new-in-denali.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-6195158930087180793</guid><pubDate>Fri, 26 Nov 2010 18:15:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.961+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Find The Number of Occurrences of a Character or a String in Another String</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;Here is one of the common questions asked in many interviews but unfortunately many candidates fail to answer to this question. The question is "&lt;strong&gt;How to find the Number of Occurrences of a Character in a String in SQL Server&lt;/strong&gt;" or "&lt;strong&gt;How to find the Number of Occurrences of a&amp;nbsp;String in another String in SQL Server&lt;/strong&gt;".&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;Below is a simple query which can answer both the above questions.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;Find the Number of Occurrences of a Character in a String using T-SQL&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;u&gt;Query&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt; @SourceString &lt;span style="color: blue;"&gt;VARCHAR&lt;/span&gt;(100)&lt;br /&gt;
&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt; @FindString &lt;span style="color: blue;"&gt;VARCHAR&lt;/span&gt;(10)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;SET&lt;/span&gt; @SourceString = &lt;span style="color: red;"&gt;'Find Number of Occurrences of a Character or a String in Another String'&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SET&lt;/span&gt; @FindString = &lt;span style="color: red;"&gt;'S'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black; font-family: Times New Roman;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; (&lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(@SourceString) - &lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(&lt;span style="color: magenta;"&gt;REPLACE&lt;/span&gt;(@SourceString, @FindString, &lt;span style="color: red;"&gt;''&lt;/span&gt;))) / &lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(@FindString) &lt;span style="color: blue;"&gt;AS&lt;/span&gt; NumberOfOccurrences&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;u&gt;Output&lt;/u&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;﻿&lt;/div&gt;&lt;div class="separator" style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo8rFWScGwpQCNy8JWD5b-RD-o79kKwIwMvGLg_VeFgJRqT0t7j5ZUP85B_zZyhfxsv_vBMViuLW-mkmDds2lGnhyphenhyphen3Cew4SOsqhz3aIYWFsT7cAQgpSsHX5flfphE_vkxX2M7wVfTqt1NO/s1600/Number+of+Occurrence+of+a+Character+in+a+String.PNG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo8rFWScGwpQCNy8JWD5b-RD-o79kKwIwMvGLg_VeFgJRqT0t7j5ZUP85B_zZyhfxsv_vBMViuLW-mkmDds2lGnhyphenhyphen3Cew4SOsqhz3aIYWFsT7cAQgpSsHX5flfphE_vkxX2M7wVfTqt1NO/s1600/Number+of+Occurrence+of+a+Character+in+a+String.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;&lt;span style="color: black;"&gt;Find the Number of Occurrences of a&amp;nbsp;String in another String using T-SQL&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;span style="color: black;"&gt;&lt;u&gt;Query&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New;"&gt;&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt; @SourceString &lt;span style="color: blue;"&gt;VARCHAR&lt;/span&gt;(100)&lt;br /&gt;
&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt; @FindString &lt;span style="color: blue;"&gt;VARCHAR&lt;/span&gt;(10)&lt;/span&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Courier New;"&gt;&lt;span style="color: blue;"&gt;SET&lt;/span&gt; @SourceString = &lt;span style="color: red;"&gt;'Find Number of Occurrences of a Character or a String in Another String'&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SET&lt;/span&gt; @FindString = &lt;span style="color: red;"&gt;'of'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black; font-family: Times New Roman;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; (&lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(@SourceString) - &lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(&lt;span style="color: magenta;"&gt;REPLACE&lt;/span&gt;(@SourceString, @FindString, &lt;span style="color: red;"&gt;''&lt;/span&gt;))) / &lt;span style="color: magenta;"&gt;LEN&lt;/span&gt;(@FindString) &lt;span style="color: blue;"&gt;AS&lt;/span&gt; NumberOfOccurrences&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;span style="color: black;"&gt;&lt;u&gt;Output&lt;/u&gt;:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3LnEMOLyQDextBjfAsPqCn4G7tz2SlfhZIfsXh00yI0jq9LZ-RmFK4WBWNB-9lIWOeNDL4QG-4ZFmeoCLk_zWLInKyxpK4mnOxVr0hRzzIjjt9ukPcTmTUBy5Ut3ul6ZVdyiPVJDsiE-k/s1600/Number+of+Occurrence+of+a+String+in+Another+String.PNG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" ox="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3LnEMOLyQDextBjfAsPqCn4G7tz2SlfhZIfsXh00yI0jq9LZ-RmFK4WBWNB-9lIWOeNDL4QG-4ZFmeoCLk_zWLInKyxpK4mnOxVr0hRzzIjjt9ukPcTmTUBy5Ut3ul6ZVdyiPVJDsiE-k/s1600/Number+of+Occurrence+of+a+String+in+Another+String.PNG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: left;"&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: justify;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: black; font-family: inherit;"&gt;As you can see the same query works for both finding the number of occurrences of a character and also a string inside another string.&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/find-number-of-occurrences-of-character.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo8rFWScGwpQCNy8JWD5b-RD-o79kKwIwMvGLg_VeFgJRqT0t7j5ZUP85B_zZyhfxsv_vBMViuLW-mkmDds2lGnhyphenhyphen3Cew4SOsqhz3aIYWFsT7cAQgpSsHX5flfphE_vkxX2M7wVfTqt1NO/s72-c/Number+of+Occurrence+of+a+Character+in+a+String.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-7220600737090619803</guid><pubDate>Wed, 17 Nov 2010 16:50:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.961+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>COUNT(*) vs. COUNT(1) - Myth vs. Reality</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; 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-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-hansi-theme-font: minor-latin;"&gt;You might have seen in many T-SQL scripts that some people use &lt;b style="mso-bidi-font-weight: normal;"&gt;SELECT COUNT(*) FROM MyTable&lt;/b&gt; and some people use &lt;b style="mso-bidi-font-weight: normal;"&gt;SELECT COUNT(1) FROM MyTable&lt;/b&gt;. Both of these return the same value and perform the same task of getting record count from a table. However, some techies believe that &lt;b style="mso-bidi-font-weight: normal;"&gt;COUNT(1)&lt;/b&gt; is better in terms of performance when compared to &lt;b style="mso-bidi-font-weight: normal;"&gt;COUNT(*)&lt;/b&gt;. Let us see if this is a &lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;Myth&lt;/i&gt;&lt;/b&gt; or a &lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;Reality&lt;/i&gt;&lt;/b&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Query Execution Results&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKHebGYD-CyBd9Xgp5OyCK_wiUnGa_tSbPgUToy1wNcJDNWc6ZsElaG2YVyLRZzR4RPK1gk1tMcstrIWTQ-oWDEoDvyBAk99Xwh1FHvTT3i12hqSUu7pNmVS9zDktwUsiTZdnfnmY-KSWP/s1600/CountStarVsCountOne_QueryResults.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKHebGYD-CyBd9Xgp5OyCK_wiUnGa_tSbPgUToy1wNcJDNWc6ZsElaG2YVyLRZzR4RPK1gk1tMcstrIWTQ-oWDEoDvyBAk99Xwh1FHvTT3i12hqSUu7pNmVS9zDktwUsiTZdnfnmY-KSWP/s640/CountStarVsCountOne_QueryResults.png" width="550" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div align="left" class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Query Execution Plans&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirTqfzuXjDtYwWwoS7AMzejPgR5fBWmmOWlxCkrCJU1-I429BWZNmM9zEHYBkRNta7VSm1Wj4igEiw2VmBPssRKE02KbD8MveHbw1M6sNquc6yvWUjY0qifU-TQHoT98nRn6Ul1byIaPTH/s1600/CountStarVsCountOne_ExecutionPlans.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="180" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirTqfzuXjDtYwWwoS7AMzejPgR5fBWmmOWlxCkrCJU1-I429BWZNmM9zEHYBkRNta7VSm1Wj4igEiw2VmBPssRKE02KbD8MveHbw1M6sNquc6yvWUjY0qifU-TQHoT98nRn6Ul1byIaPTH/s640/CountStarVsCountOne_ExecutionPlans.png" width="550" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; 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-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-hansi-theme-font: minor-latin;"&gt;In the above execution plans the &lt;b style="mso-bidi-font-weight: normal;"&gt;Stream Aggregate&lt;/b&gt; (Read it Right to Left. Second from Right.) performs the count operation. Now when you click on the &lt;b style="mso-bidi-font-weight: normal;"&gt;Stream Aggregate&lt;/b&gt; and go to the properties (press F4) window, you can see that the underlying query that gets&amp;nbsp;executed uses&amp;nbsp;&lt;b style="mso-bidi-font-weight: normal;"&gt;COUNT(*)&lt;/b&gt; in both the above cases. Below is the screenshot of properties window&amp;nbsp;of &lt;strong&gt;Stream Aggregate&lt;/strong&gt; for&amp;nbsp;both these execution plans.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHPrEhm62q-jaUPLSI5mhtn7ufY-1b1NW74R99H87lKuy8wgKhaJmr0o6RjvjqTCMD1hLxSwoXkvOAg5A-Chr0I94SrM-m6DAxXoPYEQWmiCzz5plDtRIaPUgYwpWGxLcrGq_Tcu2npYN_/s1600/CountStar_StreamAggregateProperties.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="261" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHPrEhm62q-jaUPLSI5mhtn7ufY-1b1NW74R99H87lKuy8wgKhaJmr0o6RjvjqTCMD1hLxSwoXkvOAg5A-Chr0I94SrM-m6DAxXoPYEQWmiCzz5plDtRIaPUgYwpWGxLcrGq_Tcu2npYN_/s400/CountStar_StreamAggregateProperties.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcA6TNd-9uDN4sHrQCM3V40h0ecKqTIAvSRX5nmpoMno-_B2QAYCUky_bRu1BerPAIC5dv3CFcvRwM7Cf2H5P0px_tyqz2N7hRJB4p0KlIT0NTl0pKtWeRl5SvqSDWQzm5vlu8KhFk4KMM/s1600/CountOne_StreamAggregateProperties.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcA6TNd-9uDN4sHrQCM3V40h0ecKqTIAvSRX5nmpoMno-_B2QAYCUky_bRu1BerPAIC5dv3CFcvRwM7Cf2H5P0px_tyqz2N7hRJB4p0KlIT0NTl0pKtWeRl5SvqSDWQzm5vlu8KhFk4KMM/s400/CountOne_StreamAggregateProperties.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;From the above results, it is evident that there is no performance difference between &lt;strong&gt;COUNT(*)&lt;/strong&gt; &amp;amp; &lt;strong&gt;COUNT(1)&lt;/strong&gt; and both of them boil down to &lt;strong&gt;COUNT(*)&lt;/strong&gt; in the background.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/count-vs-count1-myth-vs-reality.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKHebGYD-CyBd9Xgp5OyCK_wiUnGa_tSbPgUToy1wNcJDNWc6ZsElaG2YVyLRZzR4RPK1gk1tMcstrIWTQ-oWDEoDvyBAk99Xwh1FHvTT3i12hqSUu7pNmVS9zDktwUsiTZdnfnmY-KSWP/s72-c/CountStarVsCountOne_QueryResults.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-9017874513538013362</guid><pubDate>Wed, 17 Nov 2010 16:19:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.962+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">TFS</category><title>Getting Latest Code from TFS - The Right Way!</title><description>&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Sometimes when we try to get the latest code from TFS using &lt;b style="mso-bidi-font-weight: normal;"&gt;Get Latest Version&lt;/b&gt; option, it does not get us the latest changes in various scenarios. &lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;Example&lt;/u&gt;&lt;/b&gt;: When some of the files are removed/missing from local folder (workspace) etc.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The issue can be reproduced using the following steps:&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Connect to your Team Project on Source Control/Team Foundation Server.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Create a new workspace by mapping to appropriate folder on local file system.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Download the latest code from TFS into local using &lt;b style="mso-bidi-font-weight: normal;"&gt;Get Latest Version&lt;/b&gt; option.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Now, go to file system (workspace) and delete few of the files which you just downloaded in previous step.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; 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-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-hansi-theme-font: minor-latin;"&gt;Go back to TFS and try to get the latest version of the code using &lt;b style="mso-bidi-font-weight: normal;"&gt;Get Latest Version&lt;/b&gt; option for the same folder/workspace for which you downloaded the&amp;nbsp;latest code&amp;nbsp;in previous steps. Now you will see the following dialog box which says all your local files are up to date.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF0VhtfayqjTl40277a88D8MSVBjDyteYmw9z5CsUwb8C4gUqN8x-PWh6-cD1ZSeaOnLmEWqNgTdLbtM3iXjldF2uFaxr1JiBwS5NsPhg0oqyfNMY_0D7kPFFv-UApZ6vYap2u12tNb0Bb/s1600/GetLatestFromTFS_AllFilesUptoDate.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="225" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF0VhtfayqjTl40277a88D8MSVBjDyteYmw9z5CsUwb8C4gUqN8x-PWh6-cD1ZSeaOnLmEWqNgTdLbtM3iXjldF2uFaxr1JiBwS5NsPhg0oqyfNMY_0D7kPFFv-UApZ6vYap2u12tNb0Bb/s400/GetLatestFromTFS_AllFilesUptoDate.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Note that you deleted few files from your local folder but still &lt;strong&gt;Get Latest Version&lt;/strong&gt; option says all the local files are up to date.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;To address this issue and to get the latest code from TFS, here is the correct approach. Follow the below mentioned steps to get the Latest Code from TFS in the &lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;i style="mso-bidi-font-style: normal;"&gt;Right Way!&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Connect to your Team Project on Source Control/Team Foundation Server.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Right click on the folder for which you want to download the latest server changes to local and select &lt;b style="mso-bidi-font-weight: normal;"&gt;Get Specific Version…&lt;/b&gt; option from the context menu.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Now a dialog box appears as shown below:&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTXSTTH-7bE1c5KE88BVd2IA0jA7i2WUQft-tgzmsMJLvFQGxmyBD88Df7GP4VthjPwNuQxU_7Gv54Vb6Er-kGdBXuaVp-7ho0EE1b_4GLLRRKSVlp7GLWj4Z7xlXdkh13xJtqAjMwVlI9/s1600/GetSpecificVersion_ForceUpdate.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" px="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTXSTTH-7bE1c5KE88BVd2IA0jA7i2WUQft-tgzmsMJLvFQGxmyBD88Df7GP4VthjPwNuQxU_7Gv54Vb6Er-kGdBXuaVp-7ho0EE1b_4GLLRRKSVlp7GLWj4Z7xlXdkh13xJtqAjMwVlI9/s640/GetSpecificVersion_ForceUpdate.PNG" width="550" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;The above dialog box is self-explanatory with the items hi&lt;/span&gt;&lt;a href="http://www.blogger.com/" name="_GoBack"&gt;&lt;/a&gt;&lt;span style="font-family: inherit;"&gt;ghlighted and the callouts.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The settings in the above dialog box will get the latest version of the code from TFS into your&amp;nbsp;local environment (workspace) by overwriting any modified / unmodified files (locally in file system) and leaving any checked out files untouched/unmodified.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="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-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-hansi-theme-font: minor-latin;"&gt;Note&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="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-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US; mso-hansi-theme-font: minor-latin;"&gt;: This demonstration is based on Team Foundation Server 2010 (Visual Studio 2010 Ultimate).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/getting-latest-code-from-tfs-right-way.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF0VhtfayqjTl40277a88D8MSVBjDyteYmw9z5CsUwb8C4gUqN8x-PWh6-cD1ZSeaOnLmEWqNgTdLbtM3iXjldF2uFaxr1JiBwS5NsPhg0oqyfNMY_0D7kPFFv-UApZ6vYap2u12tNb0Bb/s72-c/GetLatestFromTFS_AllFilesUptoDate.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-8910130467621700510</guid><pubDate>Tue, 16 Nov 2010 16:08:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.963+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">BIDS</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSIS</category><title>Adding an SSIS Package to a Project - Hard Approach vs. Easy Approach</title><description>&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;I have been using an easy approach for adding an&amp;nbsp;SSIS Package&amp;nbsp;to an SSIS Project for a couple of years now. But didn't get a chance to actually blog about it. Today I decided to blog it for sure and here&amp;nbsp;I go.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Often there will be more than one option for doing many things in our day to day life and quite often the approach which we discover lately turns out to be an easy &amp;amp; simple approach.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Adding an existing SSIS Package from file system to an SSIS Project is no different. There are basically two different approaches for doing this -&amp;nbsp;The &lt;i style="mso-bidi-font-style: normal;"&gt;&lt;strong&gt;Hard Approach&lt;/strong&gt;&lt;/i&gt; &amp;amp; an &lt;i style="mso-bidi-font-style: normal;"&gt;&lt;strong&gt;Easy Approach&lt;/strong&gt;&lt;/i&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Hard Approach&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Right click on the "&lt;strong&gt;SSIS Packages&lt;/strong&gt;" folder in the SSIS project in SQL Server Business Intelligence Development Studio (BIDS) and Select "&lt;strong&gt;Add Existing Package&lt;/strong&gt;" from the context menu.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;In the "&lt;strong&gt;Add Copy of Existing Package&lt;/strong&gt;" dialog box select "&lt;strong&gt;Package location&lt;/strong&gt;" as "&lt;strong&gt;File System&lt;/strong&gt;" from the dropdown.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Click on the ellipsis button next to the "&lt;strong&gt;Package path&lt;/strong&gt;" textbox.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Locate the SSIS package (.dtsx file)&amp;nbsp;which you want to add from the file system.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Click &lt;strong&gt;OK&lt;/strong&gt; in the "&lt;strong&gt;Add Copy of Existing Package&lt;/strong&gt;" dialog box to finish adding the package.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Easy Approach&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Locate the SSIS package (.dtsx file)&amp;nbsp;which you want to add from the file system.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Right click on the SSIS package in the file system and select "&lt;strong&gt;Copy&lt;/strong&gt;" from the context menu (copy the package).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span style="font-family: inherit;"&gt;Right click on the "&lt;strong&gt;SSIS Package&lt;/strong&gt;" folder in the SSIS project in SQL Server Business Intelligence Development Studio (BIDS).&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;S&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;elect "&lt;strong&gt;Paste&lt;/strong&gt;" from the context menu to finish adding the package.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Hope you will find this tip usful.&lt;/span&gt;﻿&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/11/adding-ssis-package-to-project-hard.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-9167759194299328666</guid><pubDate>Wed, 13 Oct 2010 20:19:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.964+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>List all the Columns of an Index in Current Database in SQL Server</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit;"&gt;Last week I was writing a few validation scripts for some of the recent schema changes / performance tuning which we had done in our project. As part of this we had defined few indexes and most of them were on multiple columns. As a result of this, during validation process, I wanted to list all the columns of all the indexes in a particular database so that by looking at the output I can make sure that all the indexes are created as expected with the required columns in it. After doing some research&amp;nbsp;&amp;nbsp;on some of the system tables (like sys.objects, sys.indexes etc.), I came up with a simple SQL script which will list all the columns contained in all the indexes in the current database.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;DB_NAME&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;()&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; DatabaseName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SSch&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; SchemaName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; ObjectName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;DB_NAME&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;()&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;+&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;'.'&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;+&lt;/span&gt;&lt;/span&gt; SSch&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;+&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;'.'&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;+&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; FullyQualifiedObjectName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; ObjectType&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;CASE&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;N'U'&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;'Table'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;N'V'&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;'View'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;END&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; ObjectTypeDesc&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IndexName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IndexType&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;type_desc &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IndexTypeDesc&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;is_primary_key &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IsIndexAPrimaryKey&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SIdxCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;index_column_id &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IndexColumnSequence&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;name &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&lt;/span&gt; IndexColumnName&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;FROM&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;objects&lt;/span&gt;&lt;/span&gt; SObj&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;INNER&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;JOIN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;schemas&lt;/span&gt;&lt;/span&gt; SSch &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;schema_id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SSch&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;schema_id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;INNER&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;JOIN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;indexes&lt;/span&gt;&lt;/span&gt; SIdx &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;INNER&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;JOIN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;index_columns&lt;/span&gt;&lt;/span&gt; SIdxCol &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SIdxCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;AND&lt;/span&gt;&lt;/span&gt; SIdx&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;index_id &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SIdxCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;index_id&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;INNER&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;JOIN&lt;/span&gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;sys&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="color: green;"&gt;columns&lt;/span&gt;&lt;/span&gt; SCol&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;ON&lt;/span&gt;&lt;/span&gt; SIdxCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: magenta;"&gt;&lt;span style="color: magenta;"&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;AND&lt;/span&gt;&lt;/span&gt; SIdxCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;column_id &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;=&lt;/span&gt;&lt;/span&gt; SCol&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;column_id&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;WHERE&lt;/span&gt;&lt;/span&gt; SObj&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;type&lt;/span&gt;&lt;/span&gt; &lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;IN&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;N'U'&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;span style="color: red;"&gt;N'V'&lt;/span&gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;ORDER&lt;/span&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;BY&lt;/span&gt;&lt;/span&gt; DatabaseName&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; SchemaName&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; ObjectName&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; IndexName&lt;span style="color: grey;"&gt;&lt;span style="color: grey;"&gt;,&lt;/span&gt;&lt;/span&gt; IndexColumnSequence&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; text-align: justify;"&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;This will produce the following output:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwoql8nbRluzc_FVLiLmipPaJYzoDkW7Q-ZMEZ12QQEiW7afkPoR6WHwfzwzkCG9WhqYDSBPbcSAz_XldO07Rp-UkQwSW15MIBpFbrbHKr2hP5QzJvS7djRHCqiLBdpYZEdvAt74hbI24b/s1600/List_All_Indexes_All_Columns.PNG" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;img border="0" ex="true" height="350" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwoql8nbRluzc_FVLiLmipPaJYzoDkW7Q-ZMEZ12QQEiW7afkPoR6WHwfzwzkCG9WhqYDSBPbcSAz_XldO07Rp-UkQwSW15MIBpFbrbHKr2hP5QzJvS7djRHCqiLBdpYZEdvAt74hbI24b/s400/List_All_Indexes_All_Columns.PNG" width="560" /&gt;&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;a href="http://www.blogger.com/post-create.g?blogID=1320476894466593706#" imageanchor="1" style="clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/10/list-all-columns-of-index-in-current.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwoql8nbRluzc_FVLiLmipPaJYzoDkW7Q-ZMEZ12QQEiW7afkPoR6WHwfzwzkCG9WhqYDSBPbcSAz_XldO07Rp-UkQwSW15MIBpFbrbHKr2hP5QzJvS7djRHCqiLBdpYZEdvAt74hbI24b/s72-c/List_All_Indexes_All_Columns.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-8446726889301116444</guid><pubDate>Fri, 10 Sep 2010 17:21:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.965+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">BIDS</category><category domain="http://www.blogger.com/atom/ns#">Issues N Resolution</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><title>Issue: Execute Package Option Unavailable in SQL Server Business Intelligence Development Studio (BIDS)</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Everyone working on SQL Server and its components (SSIS, SSAS &amp;amp; SSRS) would require Business Intelligence Development Studio (BIDS) which is a really cool integrated development environment allowing us to work on different types of projects simultaneously like SSIS, SSAS &amp;amp; SSRS (All in One Solution). I came across an issue with the SSIS project, in which there was no option to execute the package.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Recently one of the developers in my team came to me complaining that while he was working on an SSIS package, he was unable to see the execute package option when he right clicked on the package in Solution Explorer in BIDS. When I took a look at his Visual Studio / BIDS, I found that some of the settings were messed up and the settings did not seemed to be same as that of a standard BIDS environment due to which the execute package option was not available in the solution explorer.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To fix this issue or in general to reset all the settings of BIDS to bring it to a state same as that of a new installation, follow the below steps:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;1&lt;/b&gt;. Open Business Intelligence Development Studio (BIDS).&lt;br /&gt;
&lt;b&gt;2&lt;/b&gt;. Go to &lt;b&gt;Tools&lt;/b&gt; menu and select &lt;b&gt;Import and Export Settings...&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6i3RegNiXOeYnRGYgVy_DZEWdqHsgfhRn_L_aEwRrtTzqg2aX-LqnHSg4WDiBFdlVBA04i0WWrhiTqfARpxZQGeiw5f8KcWJLXdwLZ0CeSgrHwEZeXU8ae5x9Z39Zg2GaXvKkrorZyShq/s320/BIDS_ToolsMenu_ImportExportSettingsOption.PNG" title="Tools Menu in BIDS" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;b&gt;3&lt;/b&gt;. This will bring up the &lt;b&gt;Import and Export Settings Wizard&lt;/b&gt; window, Select &lt;b&gt;Reset all settings&lt;/b&gt; option and click &lt;b&gt;Next&lt;/b&gt; in the &lt;b&gt;Welcome to the Import and Export Settings Wizard&lt;/b&gt; page.&lt;/div&gt;&lt;br /&gt;
&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiatvfS6omZQSZhyphenhyphenGlivzVWO-ufgzwjzaBnTCd67oxn57MrZno0Px7N-W-VmP9Bdm249LDhKI7PJ1v8MxDOMI5K_6ACXyYXvpPww2VJLWrH1jji0bRXSorBMbYTloQX6B4whh6PQlrpNX2Q/s320/BIDS_ImportExportSettingsWizard.PNG" title="Import and Export Settings Wizard in BIDS" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;u&gt;&lt;b&gt;Note&lt;/b&gt;&lt;/u&gt;: You can use this step / page to even export your custom settings to some other environment or import your settings from a different environment by selecting appropriate options.&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;b&gt;4&lt;/b&gt;. In the Save Current Settings page of the wizard, select &lt;b&gt;Yes&lt;/b&gt; (Recommended) to save the current settings so that it can be used to get back to the previous state in case if you want to revert back to the old settings of if something goes wrong in this process, Else you can may select &lt;b&gt;No&lt;/b&gt; if you dont want to save the current settings and click on &lt;b&gt;Next&lt;/b&gt;.&lt;/div&gt;&lt;br /&gt;
&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzK-JIBJl0ojgNZRwyAX4yzFC5eeSMRxvUbUNjgrZVlLNAWdIKUwzuVtyN4Xt_BnbSReLULHJmDeMiadSJeWiQuIsEnyapRlC-yIWK-sZtdIeK23JLatBnCCx_8Z_lX8BgwdkeQBYwtztO/s320/BIDS_ImportExportSettingsWizard_SaveCurrentSettings.PNG" title="Save Current Settings page of Import and Export Settings Wizard in BIDS" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;b&gt;5&lt;/b&gt;. Choose &lt;b&gt;Business Intelligence Settings&lt;/b&gt; in the &lt;b&gt;Choose a Default Collection of Settings&lt;/b&gt; page of the wizard and click &lt;b&gt;Finish&lt;/b&gt; and then click &lt;b&gt;Close&lt;/b&gt; once the BIDS settings are successfully reset.&lt;/div&gt;&lt;br /&gt;
&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP3QJ8yldhq5ZxexIvNsNlCiXCgBR4JTd_xTHwFGwrw_9HsTczZJwVkIvbCaqoSTA2UePZtrdpq1J8MdLAq6wON81PKKO0oggVW2FManSK-0VZFOHymZtfzqEOI23FUoGdSyIlJWlnvBBF/s320/BIDS_ImportExportSettingsWizard_ChooseDefualtSettings.PNG" title="Choose a Default Collection of Settings page of Import and Export Settings wizard in BIDS" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;And now your BIDS should get back to the initial state same as that of a new installation. This is a simple procedure to fix any unwanted settings by resetting all your BIDS settings.&lt;/div&gt;&lt;br /&gt;
This simple procedure can be used to do one of the following things:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Export customized BIDS settings to a different server / environment.&lt;/li&gt;
&lt;li&gt;Import customized BIDS settings from a different server / environment.&lt;/li&gt;
&lt;li&gt;Reset all the customized BIDS settings to bring it back to the original state as that of a new installation.&lt;/li&gt;
&lt;/ul&gt;</description><link>http://mytechnobook.blogspot.com/2010/09/issue-execute-package-option-disabled.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6i3RegNiXOeYnRGYgVy_DZEWdqHsgfhRn_L_aEwRrtTzqg2aX-LqnHSg4WDiBFdlVBA04i0WWrhiTqfARpxZQGeiw5f8KcWJLXdwLZ0CeSgrHwEZeXU8ae5x9Z39Zg2GaXvKkrorZyShq/s72-c/BIDS_ToolsMenu_ImportExportSettingsOption.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-742315401981047675</guid><pubDate>Sun, 29 Aug 2010 16:08:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.965+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSMS</category><title>How to Change the Sequence of Columns in Results Pane in SSMS</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Here is a really cool feature which not many of you would be aware of. All of us write simple SELECT * FROM queries in SQL Server Management Studio (SSMS). And many times, we copy the data to excel spreadsheets for additional analysis / sorting etc. Here is a simple trick to copy select columns from the results window once the results are rendered.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Go to SQL Server 2005 / 2008 Management Studio (SSMS) and open a new query window. Type a SELECT * FROM TableName query on one of the tables and run the query as shown below.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglpgYLjhGCEciEF3gup7PCkvkhAu9QgvbmPhYYdLS5dj95n0Hy60OB7YHO9fNS9g6IrTS3pbZy-cu_F7jMJgQX7LGOuvqj_uLXp4lbKCNaKYIGAoN2nhJf3bPE8xwVBwFNX69gmnis0VSJ/s1600/Results_Column_Sequence_In_SSMS_Before.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_new"&gt;&lt;img border="0" height="353" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglpgYLjhGCEciEF3gup7PCkvkhAu9QgvbmPhYYdLS5dj95n0Hy60OB7YHO9fNS9g6IrTS3pbZy-cu_F7jMJgQX7LGOuvqj_uLXp4lbKCNaKYIGAoN2nhJf3bPE8xwVBwFNX69gmnis0VSJ/s320/Results_Column_Sequence_In_SSMS_Before.PNG" width="560" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Now let us say that you want to select only the following columns in the same sequence as specified below:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;GeographyKey&lt;/li&gt;
&lt;li&gt;EnglishCountryRegionName&lt;/li&gt;
&lt;li&gt;StateProvinceName&lt;/li&gt;
&lt;li&gt;City&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;If you observe the results displayed in the previous screenshot, you can see that the columns are not in the same sequence as listed above and the query does not contain the column names, so you cant change the change the sequence of columns in the query. If you have to change the sequence of columns using the query, then you need to type in the column names. But here is a simple way to do it and no need to type the columns.&lt;br /&gt;
&lt;br /&gt;
Now click on the column &lt;b&gt;EnglishCountryRegionName&lt;/b&gt;, hold it and drag it next to &lt;b&gt;GeographyKey&lt;/b&gt; column till you see a red color line next to the &lt;b&gt;GeographyKey&lt;/b&gt; column header as shown below.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghHgjXewdgz1VfhdsD2-8If7oHphhjbTKXXPoo1AS137CH-qt_ARCiCqfYCR4t5kgsLJzuaqJEmZknmVDMeAkqFfJfk_k4pCJUZsO8ms6UCJ7L59XwO-6XshiwH8AGfDMzAYOkXiQjGP96/s1600/Results_Column_Sequence_In_SSMS_During.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_new"&gt;&lt;img border="0" height="353" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghHgjXewdgz1VfhdsD2-8If7oHphhjbTKXXPoo1AS137CH-qt_ARCiCqfYCR4t5kgsLJzuaqJEmZknmVDMeAkqFfJfk_k4pCJUZsO8ms6UCJ7L59XwO-6XshiwH8AGfDMzAYOkXiQjGP96/s320/Results_Column_Sequence_In_SSMS_During.PNG" width="560" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Now, similarly move the &lt;b&gt;StateProvinceName&lt;/b&gt; column after &lt;b&gt;EnglishCountryRegionName&lt;/b&gt; and before &lt;b&gt;City&lt;/b&gt; columns as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMBEkZzirTYbfsmazg0J6_8DodVxlzMpbC0MsxSKNLUPy_44seqDpukk2Wu04n1dRX5_dc9yQ-v5R8jUGP1w-opqdHqcemZneu6odzqytq-TNo722iixj_vUc-PDBwEn2bJ_4wAn3NDXyK/s1600/Results_Column_Sequence_In_SSMS_After.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_new"&gt;&lt;img border="0" height="353" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMBEkZzirTYbfsmazg0J6_8DodVxlzMpbC0MsxSKNLUPy_44seqDpukk2Wu04n1dRX5_dc9yQ-v5R8jUGP1w-opqdHqcemZneu6odzqytq-TNo722iixj_vUc-PDBwEn2bJ_4wAn3NDXyK/s320/Results_Column_Sequence_In_SSMS_After.PNG" width="560" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Once all the required columns are re-arranged, you can easily copy all the required columns and copy them to excel easily as shown above.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
Hope you like this trick. If there is a better and quicker way of achieving the same thing in SSMS, then let me know by leaving a comment below.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Related Articles&lt;/b&gt;&lt;/u&gt;:&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/"&gt;Shortcuts for SQL Server Client Applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/09/commonly-used-keyboard-shortcuts-in-sql.html"&gt;Commonly used Keyboard Shortcuts in SQL Server Management Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/05/colored-connections-in-sql-server-2008.html"&gt;Colored Connections in SQL Server 2008&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/06/t-sql-coding-made-easy-using-inbuilt.html"&gt;T-SQL Coding Made Easy with Inbuilt SQL Server Templates&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/08/how-to-change-sequence-of-columns-in.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglpgYLjhGCEciEF3gup7PCkvkhAu9QgvbmPhYYdLS5dj95n0Hy60OB7YHO9fNS9g6IrTS3pbZy-cu_F7jMJgQX7LGOuvqj_uLXp4lbKCNaKYIGAoN2nhJf3bPE8xwVBwFNX69gmnis0VSJ/s72-c/Results_Column_Sequence_In_SSMS_Before.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-9106014374671234430</guid><pubDate>Fri, 20 Aug 2010 16:40:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.966+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Query to Get Week Start Date, Month Start Date and Year Start Date Based on Input Date</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In one of the recent projects, there was a requirement to set the First Day of the Week as Start Date and Current Date as End Date for a Week Level Report. Similarly, First Day of Month &amp;amp; Current Date and First Day of Year &amp;amp; Current Date for Month Level and Year Level Reports respectively.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To address this requirement, one of the developers wrote a query to get the first day of the week considering the week starts on a Monday and the query seemed to work fine on his computer but when we moved that code to my computer then the results were different &amp;amp; were completely incorrect. When I started looking into the issue I found that he was using DATEPART function of SQL Server something like DATEPART(DW, @InputDate). After doing some analysis &amp;amp; referring to the properties / behavior of this function on MSDN library, I found that the return value of this function depends on the setting of DATEFIRST.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;One can find out the current state of DATEFIRST property by running the following simple SELECT statement.&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;@@DATEFIRST&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Refer to the &lt;span id="goog_1853046379"&gt;&lt;/span&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms174420.aspx" target="_blank"&gt;DATEPART()&lt;span id="goog_1853046380"&gt;&lt;/span&gt;&lt;/a&gt; function on MSDN library for more details.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Following is the query which gives accurate results under all circumstances:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;br /&gt;
&lt;span style="color: blue; font-size: x-small;"&gt;DECLARE&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;@dttRequestedDateTime&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: x-small; font-style: italic;"&gt;DATETIME&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;=&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="color: red;"&gt;'2010-08-20'&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;span style="color: green; font-size: x-small; font-style: italic;"&gt;--&amp;nbsp;Replace '2010-08-20' with&amp;nbsp;Input&amp;nbsp;Date&amp;nbsp;or&amp;nbsp;Requested&amp;nbsp;Date&lt;/span&gt;&lt;span style="color: blue; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue; font-size: x-small;"&gt;DECLARE&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: x-small; font-style: italic;"&gt;DATE&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;=&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: magenta; font-size: x-small; font-style: italic;"&gt;CAST&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;(&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;@dttRequestedDateTime&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: x-small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: x-small; font-style: italic;"&gt;DATE&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;)&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue; font-size: x-small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="color: #8000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @dtInputDate&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;span style="color: maroon;"&gt;[InputDate]&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;CASE&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Monday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Tuesday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Wednesday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;2&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Thursday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;3&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Friday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;4&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Saturday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;5&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;WHEN&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATENAME&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DW&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Sunday'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;THEN&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&lt;span style="color: black;"&gt;6&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;END &lt;/span&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;span style="color: maroon;"&gt;[WeekStartDate]&lt;/span&gt;&lt;span style="color: silver;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="color: silver;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&lt;/span&gt; &lt;span style="color: magenta; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;DD&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;-&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta; font-style: italic;"&gt;DATEPART&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;DAY&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;span style="color: maroon;"&gt;[MonthStartDate]&lt;/span&gt;&lt;span style="color: silver;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: silver; font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;span style="color: magenta; font-size: x-small; font-style: italic;"&gt;DATEADD&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;DD&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;,&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: x-small;"&gt;1&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;-&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: magenta; font-size: x-small; font-style: italic;"&gt;DATEPART&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;DAYOFYEAR&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;,&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;)&lt;/span&gt;&lt;span style="color: silver; font-size: x-small;"&gt;,&lt;/span&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: x-small;"&gt;@dtInputDate&lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;)&lt;/span&gt;&lt;span style="color: blue; font-size: x-small;"&gt; AS&lt;/span&gt;&lt;span style="font-size: x-small;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-size: x-small;"&gt;[YearStartDate]&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;Here is the output of this query:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small;"&gt;InputDate&amp;nbsp; WeekStartDate MonthStartDate YearStartDate&lt;br /&gt;
---------- ------------- -------------- -------------&lt;br /&gt;
2010-08-20 2010-08-16&amp;nbsp;&amp;nbsp;&amp;nbsp; 2010-08-01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2010-01-01&lt;br /&gt;
&lt;br /&gt;
(1 row(s) affected)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-SL9wpTHjzVAcCOZdle70Zx3UcobVsjoB6Escz4CoytXIgI2e-Wk__rJklmYTytqncKhAaAYyy-ODL3y_GHU0kcCP2NkuAV8TQrRjvoBXHS-iw-K_ezHsdgPdSOlQHVz7HcHA1F-vEzk9/s1600/WeekStartDate_MonthStartDate_YearStartDate.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;" target="_blank"&gt;&lt;img border="0" height="319" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-SL9wpTHjzVAcCOZdle70Zx3UcobVsjoB6Escz4CoytXIgI2e-Wk__rJklmYTytqncKhAaAYyy-ODL3y_GHU0kcCP2NkuAV8TQrRjvoBXHS-iw-K_ezHsdgPdSOlQHVz7HcHA1F-vEzk9/s400/WeekStartDate_MonthStartDate_YearStartDate.PNG" width="550" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Week Start Date, Month Start Date &amp;amp; Year Start Date&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Let me know if you have a better way of getting the same results by leaving a comment below.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;u&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;u&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Related Articles and Links&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/09/sql-query-formatting-standards.html"&gt;T-SQL - Coding Standards &amp;amp; Best Practices&lt;/a&gt; &lt;/span&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/06/t-sql-coding-made-easy-using-inbuilt.html"&gt;&lt;span style="font-size: small;"&gt;T-SQL Coding Made Easy with Inbuilt SQL Server Templates&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/03/query-to-select-random-record-from.html"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Query to Select a Random Record from a Table in SQL Server&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/08/query-to-get-week-start-date-month.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-SL9wpTHjzVAcCOZdle70Zx3UcobVsjoB6Escz4CoytXIgI2e-Wk__rJklmYTytqncKhAaAYyy-ODL3y_GHU0kcCP2NkuAV8TQrRjvoBXHS-iw-K_ezHsdgPdSOlQHVz7HcHA1F-vEzk9/s72-c/WeekStartDate_MonthStartDate_YearStartDate.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-1507181895148950044</guid><pubDate>Tue, 06 Jul 2010 17:07:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.967+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Create Attractive Technical and Non-Technical Charts and Diagrams Online For FREE</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;We create Flow Charts, Architecture Diagrams, Diagrams for visual representation of Processes and Concepts etc. There are various tools in the market for different types of diagrams with various features to suit different set of requirements like Erwin is a data modeling tool used to create data model, Microsoft Office Visio is used for creation of various categories of diagrams like basic flow chart, process flow diagram etc. We can also create diagrams in Microsoft Word. However most of these products are paid versions and need an installation on your computer.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Ever thought of a tool which offers you with most of the features which are offered by the tools mentioned above and lot of other attractive features in addition to those offered by the above listed tools absolutely free! Yes here is a great tool called FlowChart.com (&lt;a href="http://www.flowchart.com/" target="_blank"&gt;www.flowchart.com&lt;/a&gt;), which is a fully loaded tool for creation of flow charts, process flow diagrams, architecture diagrams and a lot of other attractive diagrams and guess what ? All this for free and on the go with an online interface.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;The User Interface / Grid View of the tool looks similar to the grid view of Microsoft Office Visio.Below is a snapshot of the Online User Interface of FLOWCHART.COM.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg8qfBd0y7Ptc00s-PPgTBf3r8Ihyx-FFEk2oHBMDSxXRxBxA-yuVbSGkXW_CDrI8N7rDHBLyk0t8Ljrn0-MhwKHmr4AaCT7xG0XQY4VCrapvkt2IagYx-Z26AmLCU3vSCOAS1sqE11INu/s1600/FlowChartDotCom_OnlineChartEditor.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg8qfBd0y7Ptc00s-PPgTBf3r8Ihyx-FFEk2oHBMDSxXRxBxA-yuVbSGkXW_CDrI8N7rDHBLyk0t8Ljrn0-MhwKHmr4AaCT7xG0XQY4VCrapvkt2IagYx-Z26AmLCU3vSCOAS1sqE11INu/s400/FlowChartDotCom_OnlineChartEditor.PNG" width="550" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Currently the tool is in its beta version and offers a limited set of registrations based on the availability. Below is a sample flow diagram created using FLOWCHART.COM with the steps signing up with FLOWCHART.COM and creation of flowcharts / diagrams.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;iframe height="778" src="http://flowchart.com/embedded/3e28af63cfba5a68/?&amp;amp;signature=23dd3eb6" width="550"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;There are few sample video demos available on their site as well as on other Video Hosting sites. Below is a sample video of FLOWCHART.COM.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="413" width="550"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4283347&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=0&amp;amp;show_portrait=1&amp;amp;color=CCCCCC&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=4283347&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=0&amp;amp;show_portrait=1&amp;amp;color=CCCCCC&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="550" height="413"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here are few of the key highlights of the tool:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Fully loaded tool offering lot of attractive features for creation of charts / diagrams etc.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Does not require any installation.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;You can create diagrams on the go by just having access to internet.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;All these features for Free!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Visit FLOWCHART.COM to Sign-Up and start creating attractive charts / diagrams with this fully loaded tool :-)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/07/create-attractive-technical-and-non.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg8qfBd0y7Ptc00s-PPgTBf3r8Ihyx-FFEk2oHBMDSxXRxBxA-yuVbSGkXW_CDrI8N7rDHBLyk0t8Ljrn0-MhwKHmr4AaCT7xG0XQY4VCrapvkt2IagYx-Z26AmLCU3vSCOAS1sqE11INu/s72-c/FlowChartDotCom_OnlineChartEditor.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-239170827711629479</guid><pubDate>Sun, 27 Jun 2010 16:30:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.968+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSRS</category><title>Difference between SSRS 2005 and SSRS 2008</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Few of my colleagues and friends have been asking me for a while to write something on the differences between SQL Server Reporting Services versions 2005 and 2008. Especially when they were preparing for interviews / attending interviews, this was one of the most common questions they were asked by the interviewers. However when they browsed on the net, they could not get a comprehensive list of differences between SSRS 2005 and SSRS 2008 not even in a single place. Hence I came up with this idea of presenting some of the major differences between SSRS 2005 &amp;amp; 2008 so that it is helpful for the people who are curious to know about the differences between SSRS 2005 &amp;amp; 2008 and also for those people who are preparing for an interview on SQL Server Reporting Services.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;div style="text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGFI5lPG2EBBaDbfIrmJjYvCBe_CRlgkSlAgQhyphenhyphenZRaPKYL1AMfsjS_9qQnSqQ9t4TOvJnn16nHp6Uu9P5mbFWkvD7InL86aof8gS26RAzlKLKFVEO7vaN0v_-WTWNY1TnKZestudSkGEo/s1600/SSRS2005_vs_SSRS2008.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="277" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGFI5lPG2EBBaDbfIrmJjYvCBe_CRlgkSlAgQhyphenhyphenZRaPKYL1AMfsjS_9qQnSqQ9t4TOvJnn16nHp6Uu9P5mbFWkvD7InL86aof8gS26RAzlKLKFVEO7vaN0v_-WTWNY1TnKZestudSkGEo/s400/SSRS2005_vs_SSRS2008.PNG" width="400" /&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Below table shows few of the differences between 2005 and 2008 versions of SQL Server Reporting Services in the order of priority (major to minor differences from top to bottom).&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;table border="2" cellpadding="2" style="font-family: inherit;"&gt;&lt;caption&gt;&lt;span style="font-size: small;"&gt;Comparison of SSRS 2005 and SSRS 2008&lt;/span&gt;&lt;/caption&gt; &lt;tbody&gt;
&lt;tr&gt; &lt;th bgcolor="#d8d8d8" border="2px"&gt;&lt;span style="font-size: small;"&gt;SQL Server 2005 Reporting Services&lt;/span&gt;&lt;/th&gt; &lt;th bgcolor="#d8d8d8" border="2px"&gt;&lt;span style="font-size: small;"&gt;SQL Server 2008 Reporting Services&lt;/span&gt;&lt;/th&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;span style="font-size: small;"&gt;Multiple service architecture (IIS Service &amp;amp; Windows Service)&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Single service architecture (Windows Service)&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Depends on IIS&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Comes with Built-In Web Server and hence does not depend on IIS&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Complex deployment due to the need for separate configuration for IIS&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Deployment is simple due to inbuilt web server and Reporting Services Configuration Manager&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Charts, Dials etc. had to be separately installed and integrated&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Comes packaged with Charts, Dials, Indicators, Sparklines etc.&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Limited exporting options&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;More exporting options including Microsoft Word etc&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;You can only format entire text in a textbox with one single formatting style (&lt;b&gt;bold&lt;/b&gt;, &lt;i&gt;italicize&lt;/i&gt;, &lt;b&gt;&lt;span style="color: red;"&gt;&lt;span style="color: blue;"&gt;co&lt;/span&gt;lo&lt;/span&gt;&lt;span style="color: #38761d;"&gt;rs&lt;/span&gt;&lt;/b&gt; etc.)&lt;/span&gt;&lt;/td&gt; &lt;td border="2px" width="50%"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Allows you to format pieces of text or words or letters within a single textbox with different formatting styles like &lt;b&gt;bold&lt;/b&gt;, &lt;i&gt;italicize&lt;/i&gt;, &lt;b&gt;&lt;span style="color: blue;"&gt;co&lt;/span&gt;&lt;span style="color: red;"&gt;lo&lt;/span&gt;&lt;span style="color: #38761d;"&gt;rs&lt;/span&gt;&lt;/b&gt; etc. &lt;u&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/u&gt;: a Disclaimer Textbox, Header Textbox etc.&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Apart from this there are quite a few other differences or improvements in SQL Server 2008 Reporting Services.&lt;/span&gt;&lt;span style="font-size: small;"&gt; For more details, please see the &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/reporting.aspx" target="_blank"&gt;Product Information Page&lt;/a&gt; for SQL Server 2008 Reporting Services.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;  &lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;This post is specially for Suneel who had asked for this quite long time back :-)&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;If there are any other major differences which are worth mentioning then do leave a comment, so that the post can be updated and other readers can benefit from it.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;As always for any comments / suggestions / opinions, please leave a comment below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Related Articles&lt;/b&gt;&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/08/features-of-sql-server-reporting.html"&gt;Features of SQL Server Reporting Services (SSRS)&lt;/a&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/09/shortcuts-for-sql-server-client.html"&gt;Shortcuts for SQL Server Client Applications&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/01/controlling-exporting-options-in.html"&gt;Controlling Exporting Options in Reporting Services (SSRS)&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/2010/03/how-to-display-report-execution-time-in.html"&gt;How to Display Report Execution Time in Reporting Services (SSRS)&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://mytechnobook.blogspot.com/search/label/SSRS"&gt;Other SSRS Related Articles on MyTechnoBook&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/06/difference-between-ssrs-2005-and-ssrs.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGFI5lPG2EBBaDbfIrmJjYvCBe_CRlgkSlAgQhyphenhyphenZRaPKYL1AMfsjS_9qQnSqQ9t4TOvJnn16nHp6Uu9P5mbFWkvD7InL86aof8gS26RAzlKLKFVEO7vaN0v_-WTWNY1TnKZestudSkGEo/s72-c/SSRS2005_vs_SSRS2008.PNG" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-5590640367797641592</guid><pubDate>Tue, 22 Jun 2010 16:36:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.969+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>T-SQL Tidy - An Online T-SQL Statement Parser and Formatter</title><description>&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Yesterday I came across another interesting and useful online tool for formatting T-SQL queries quickly. &lt;a href="http://www.tsqltidy.com/" target="_blank"&gt;&lt;b&gt;T-SQL Tidy&lt;/b&gt;&lt;/a&gt; is a free online tool which can format numerous lines of T-SQL code within seconds.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;I had written another article about Instant SQL Formatter (Read more &lt;a href="http://mytechnobook.blogspot.com/2010/06/formatting-t-sql-queries-made-easy-with.html"&gt;here&lt;/a&gt;) which is also a great tool for formatting T-SQL queries &amp;amp; also various other database queries like MS Access, Oracle etc and offers various output options including HTML, C#, VB.Net etc. On the other hand &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;a href="http://www.tsqltidy.com/" target="_blank"&gt;&lt;b&gt;T-SQL Tidy&lt;/b&gt;&lt;/a&gt; offers more formatting options along with a beautiful HTML output with alternate colored lines.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Here is a snapshot of the online version of the T-SQL Tidy user interface with the formatting options highlighted.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOt3-g0bCKkQ2yPkIYI6gn9DiP78B2YXSlzszbLiuwkPPJZt3Cy0EiKGtuycWsi2AM9kzpRogM7euzDlwikDvk5X1BpCU2RSIfGB1TQYvxG-4-TNmewCgcMn3GC3AfNm87m771ZASTwo2n/s1600/T-SQL_Tidy_Online_T-SQL_Statement_Parser_and_Formatter.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOt3-g0bCKkQ2yPkIYI6gn9DiP78B2YXSlzszbLiuwkPPJZt3Cy0EiKGtuycWsi2AM9kzpRogM7euzDlwikDvk5X1BpCU2RSIfGB1TQYvxG-4-TNmewCgcMn3GC3AfNm87m771ZASTwo2n/s400/T-SQL_Tidy_Online_T-SQL_Statement_Parser_and_Formatter.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Apart from the online version, T-SQL Tidy also has the following other Versions / Add-ins: &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.tsqltidy.com/tsqltidyfordesktop.aspx" target="_blank"&gt;T-SQL Tidy for Desktops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.tsqltidy.com/tsqltidySSMSAddin.aspx" target="_blank"&gt;SQL Server Management Studio (SSMS) 2008 Add-in&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.tsqltidy.com/SQLVersionControl.aspx" target="_blank"&gt;Version Control Add-in for SQL Management Studio 2008&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Here is the official &lt;a href="http://tsqltidy.blogspot.com/" target="_blank"&gt;T-SQL Tidy Blog&lt;/a&gt;. Visit this blog regularly to stay updated on the improvements &amp;amp; new features / add-ins available for T-SQL Tidy. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Here are few of the important features of T-SQL Tidy:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Offers more formatting options.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Version Control Add-in for SSMS (2008) allows you to view the version of objects in SSMS and maintains the history, which will help you identify what changes were made, when and what is the difference between any two particular versions. This can be really useful if you want to revert back to previous version of a Table Structure or any other database object. Watch video demo &lt;a href="http://www.tsqltidy.com/SQLVersionControl.aspx" target="_blank"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;HTML output comes with a choice to make alternate rows in different colors.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;One of the limitations of this tool is limited output options (T-SQL, HTML etc.) and supports only SQL Server (2000 / 2005 / 2008).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Overall, its a great tool to instantly format your T-SQL queries, which can save you lot of time, especially when your typing speed is slow and you cannot switch between upper &amp;amp; lower case characters, cannot use frequent tabs to include necessary indentation etc.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt;Read more about another T-SQL formatting tool, Instant SQL Formatter &lt;a href="http://mytechnobook.blogspot.com/2010/06/formatting-t-sql-queries-made-easy-with.html"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: inherit;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/06/t-sql-tidy-online-t-sql-statement.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOt3-g0bCKkQ2yPkIYI6gn9DiP78B2YXSlzszbLiuwkPPJZt3Cy0EiKGtuycWsi2AM9kzpRogM7euzDlwikDvk5X1BpCU2RSIfGB1TQYvxG-4-TNmewCgcMn3GC3AfNm87m771ZASTwo2n/s72-c/T-SQL_Tidy_Online_T-SQL_Statement_Parser_and_Formatter.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-6312643516663972659</guid><pubDate>Thu, 17 Jun 2010 17:59:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.969+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><title>Formatting T-SQL Queries Made Easy with Instant SQL Formatter</title><description>Writing well formatted T-SQL queries is an art and takes quite a bit of patience to do the formatting. While working with various project teams, I often advise my team members and people who are new to SQL Server to format the SQL queries and always follow some conventions / standards (Read more on T-SQL Coding Standards &amp;amp; Best Practices &lt;a href="http://mytechnobook.blogspot.com/2009/09/sql-query-formatting-standards.html"&gt;here&lt;/a&gt;).&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;However, quite a few times either due to laziness or due to time constraints, many developers do not format the queries properly. This makes the queries less readable and difficult to maintain.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I came across a really cool tool few months back and wanted to share the same with broader audience, but missed many times due to various distractions. And today finally I decided to post it on my blog :-)&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Here is a tool called &lt;a href="http://www.dpriver.com/pp/sqlformat.htm" target="_blank"&gt;&lt;b&gt;Instant SQL Formatter&lt;/b&gt;&lt;/a&gt; which is really cool, easy to use, pretty powerful and can format your T-SQL queries in seconds. Many of you might already be knowing about this tool,&amp;nbsp; since this has been in the market for quite some time now. However I have presented few of the benefits and other details so that people who do not know about this can get benefited. Here is a screenshot of the online version of the Instant SQL Formatter.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFQ3J97IlueTvQtVhxRb98p8eEkdL5eUMHjFSDNKm0g9ESiw9zH3NVPP4-grkbu4I7PU3o0nt49i4mAFfKLYNBrX0oND5OTbwOMnGHplPkU6YpON6vFsCcMpgiMkbJcXCqBj63_2q6jKC/s1600/Instant_SQL_Formatter_Online_Screen.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFQ3J97IlueTvQtVhxRb98p8eEkdL5eUMHjFSDNKm0g9ESiw9zH3NVPP4-grkbu4I7PU3o0nt49i4mAFfKLYNBrX0oND5OTbwOMnGHplPkU6YpON6vFsCcMpgiMkbJcXCqBj63_2q6jKC/s400/Instant_SQL_Formatter_Online_Screen.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Here are few cool features of Instant SQL Formatter:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Supports queries from databases like MS Access, DB2, Microsoft SQL, MySQL, Oracle / PLSQL and other Generic queries.&lt;/li&gt;
&lt;li&gt;Supports various output formats like Text, HTML, Java, C#, VB.Net, XML and many more.&lt;/li&gt;
&lt;li&gt;Gives control over how you want to format &lt;b&gt;Keywords&lt;/b&gt; (Uppercase, Lowercase, InitCap, Unchanged), &lt;b&gt;Identifiers&lt;/b&gt; (Uppercase, Lowercase, InitCap, Unchanged, Init cap each word), &lt;b&gt;Functions&lt;/b&gt; (Uppercase, Lowercase, InitCap, Unchanged) etc.&lt;/li&gt;
&lt;li&gt;Formats 100's of lines of lines of code in just few 10's of seconds.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Guess what, the best thing I like about Instant SQL Formatter is its ability to output formatted T-SQL code in Text format along with HTML format, which bloggers like me can use to embed code into blog posts :-) &lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Apart from the &lt;a href="http://www.dpriver.com/pp/sqlformat.htm" target="_blank"&gt;Online Version&lt;/a&gt;, here are few other Versions / Add-Ins of Instant SQL Formatter:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.dpriver.com/products/sqlpp/desktop_index.php" target="_blank"&gt;Instant SQL Formatter - Desktop Version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.dpriver.com/products/sqlpp/vs_index.php" target="_blank"&gt;Instant SQL Formatter - Add-In for Visual Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.dpriver.com/products/sqlpp/ssms_index.php" target="_blank"&gt;Instant SQL Formatter - Add-In for SQL Server Management Studio (SSMS)&lt;/a&gt; (More on SSMS Shortcuts &lt;a href="http://mytechnobook.blogspot.com/2009/09/commonly-used-keyboard-shortcuts-in-sql.html"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;This is a real time saver tool and is worth giving a try.&lt;br /&gt;
&lt;br /&gt;
Here are few of the most important advantages of writing well formatted T-SQL queries:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Makes the query readable and makes it look cleaner.&lt;/li&gt;
&lt;li&gt;Easy to maintain due to high readability.&lt;/li&gt;
&lt;li&gt;Using same set of formatting rules / standards across modules / projects ensures consistency.&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;And as always, for any comments / suggestions, please leave a comment below.&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/06/formatting-t-sql-queries-made-easy-with.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHFQ3J97IlueTvQtVhxRb98p8eEkdL5eUMHjFSDNKm0g9ESiw9zH3NVPP4-grkbu4I7PU3o0nt49i4mAFfKLYNBrX0oND5OTbwOMnGHplPkU6YpON6vFsCcMpgiMkbJcXCqBj63_2q6jKC/s72-c/Instant_SQL_Formatter_Online_Screen.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-3147626212229051521</guid><pubDate>Sat, 12 Jun 2010 12:23:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.970+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSMS</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>T-SQL Coding Made Easy with Inbuilt SQL Server Templates</title><description>&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;I have seen many people, even though they know what function / clause / keyword to be used for a particular T-SQL / Other type of query / operation, they don't remember the exact syntax [Including me at times :-)]. From my perspective as long as we know what keywords / functions / clauses need to be used for performing a specific operation using T-SQL / Other language (like MDX, DMX etc), we can always get the syntax from various sources like msdn, SQL Server Books Online (Local / Online version) etc. and get the task done.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;However, if you have an option of getting the well formatted code snippet with the syntax of all the commonly performed T-SQL / MDX / DMX etc. operations right in the query editor window, then nothing like it. I would love such a feature.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Microsoft as always known for offering most powerful and user friendly tools has provided a separate section / explorer in SQL Server Management Studio 2005 / 2008 which contains the templates / code snippets for all the commonly performed operations in T-SQL, MDX, DMX etc. This feature / explorer is called as &lt;b&gt;Template Explorer&lt;/b&gt;. Few of you reading this post might already be knowing about this feature, but explaining it in detail for those readers who have not used this feature before.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Following is a snapshot of Template Explorer in SQL Server 2008 Management Studio showing the list of various well formatted code snippets grouped into various categories. Below snapshot shows all the available categories of code snippets for T-SQL operations in SQL Server 2008 with the list of code snippets expanded for commonly performed T-SQL operations on tables.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ2QCIQX9RscqkS3x1dgy9rwPN1A4U7zYKfrWAXlLaXqLFZsL5CkwmEATs__TigP55TQy3u5TaKqZtksy7i4Wj8yf7bkmCjm4EHfPy9A4X_SUu-0J_vhDhYZdk4bPijH-hau6UEeOhrVtE/s1600/SSMS_TemplateExplorer_SQLServer.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ2QCIQX9RscqkS3x1dgy9rwPN1A4U7zYKfrWAXlLaXqLFZsL5CkwmEATs__TigP55TQy3u5TaKqZtksy7i4Wj8yf7bkmCjm4EHfPy9A4X_SUu-0J_vhDhYZdk4bPijH-hau6UEeOhrVtE/s640/SSMS_TemplateExplorer_SQLServer.PNG" width="267" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Template Explorer in SQL Server Management Studio (SSMS) can be accessed using the following ways:&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;SSMS Menus - &lt;b&gt;View&lt;/b&gt; -&amp;gt; &lt;b&gt;Template Explorer&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;SSMS Shortcut - &lt;b&gt;Ctrl + Alt + T&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Following screenshots show the comparison of Template Explorer between SQL Server 2005 &amp;amp; SQL Server 2008 for T-SQL / SQL Server, MDX, Mobile / Compact Editions.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOgGXtR6folNoyq-fhhHtnPRgXZ7NzYsGPWENK8yxHDE276H7fQI3EspYsWAYZgiAITfhAUTPzsSYi05_GrrGVupxOq22o87HLitHaUD5Xeggcfz_AIyus8d8WqV4r1YtQnSQPQfgORUkr/s1600/SSMS_TemplateExplorer_SQLServer_2005_2008.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOgGXtR6folNoyq-fhhHtnPRgXZ7NzYsGPWENK8yxHDE276H7fQI3EspYsWAYZgiAITfhAUTPzsSYi05_GrrGVupxOq22o87HLitHaUD5Xeggcfz_AIyus8d8WqV4r1YtQnSQPQfgORUkr/s640/SSMS_TemplateExplorer_SQLServer_2005_2008.PNG" width="377" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguMNx3LTG0k7ydf_iQX4BoemC8c6fOvj27CmSocvOLqTq88pNbzMYC2gczVeY4ENOjVJR5cWm9dvFYvKbuwxMMfztRSzGCwn8zR8e3p9yxq7JtTKknlWUsWhDmxzsCb2DwPrCIOzqnmvtS/s1600/SSMS_TemplateExplorer_AS_2005_2008.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="267" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguMNx3LTG0k7ydf_iQX4BoemC8c6fOvj27CmSocvOLqTq88pNbzMYC2gczVeY4ENOjVJR5cWm9dvFYvKbuwxMMfztRSzGCwn8zR8e3p9yxq7JtTKknlWUsWhDmxzsCb2DwPrCIOzqnmvtS/s400/SSMS_TemplateExplorer_AS_2005_2008.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAVigW2CEbfKmIrcKSYkWBGNfWf12Tky_6g2CypduPoFWZ6KfoirIhdlI_RkZc_ijK38pqnPK8NMJ8SMIfBhbKilnPtDXrDPuNv_VJjyrczAgnGM44PW8aMyoW3T2Dx3mPUZO4_vaAEvmo/s1600/SSMS_TemplateExplorer_Mobile_2005_Compact_2008.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="302" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAVigW2CEbfKmIrcKSYkWBGNfWf12Tky_6g2CypduPoFWZ6KfoirIhdlI_RkZc_ijK38pqnPK8NMJ8SMIfBhbKilnPtDXrDPuNv_VJjyrczAgnGM44PW8aMyoW3T2Dx3mPUZO4_vaAEvmo/s400/SSMS_TemplateExplorer_Mobile_2005_Compact_2008.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Now let us take a look at how to generate the table creation script for a sample table using the Create Table template available in Template Explorer.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Go to template explorer and expand the Tables folder under SQL Server section in Template Explorer as shown in the above figure 1. Now double click on the Create Table template to open it in a new query editor window.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;Following code snippet is present in the Create Table template:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;textarea cols="70" readonly="readonly" rows="10"&gt;-- ========================================= -- Create table template -- ========================================= USE &amp;lt;database, sysname, AdventureWorks&amp;gt; GO  IF OBJECT_ID('&amp;lt;schema_name, sysname, dbo&amp;gt;.&amp;lt;table_name, sysname, sample_table&amp;gt;', 'U') IS NOT NULL   DROP TABLE &amp;lt;schema_name, sysname, dbo&amp;gt;.&amp;lt;table_name, sysname, sample_table&amp;gt; GO  CREATE TABLE &amp;lt;schema_name, sysname, dbo&amp;gt;.&amp;lt;table_name, sysname, sample_table&amp;gt; (  &amp;lt;columns_in_primary_key, , c1&amp;gt; &amp;lt;column1_datatype, , int&amp;gt; &amp;lt;column1_nullability,, NOT NULL&amp;gt;,   &amp;lt;column2_name, sysname, c2&amp;gt; &amp;lt;column2_datatype, , char(10)&amp;gt; &amp;lt;column2_nullability,, NULL&amp;gt;,   &amp;lt;column3_name, sysname, c3&amp;gt; &amp;lt;column3_datatype, , datetime&amp;gt; &amp;lt;column3_nullability,, NULL&amp;gt;,      CONSTRAINT &amp;lt;contraint_name, sysname, PK_sample_table&amp;gt; PRIMARY KEY (&amp;lt;columns_in_primary_key, , c1&amp;gt;) ) GO &lt;/textarea&gt; &lt;br /&gt;
&lt;br /&gt;
Now go to &lt;b&gt;Query&lt;/b&gt; -&amp;gt; &lt;b&gt;Specify Values from Template Parameters...&lt;/b&gt; in SSMS. This brings up a pop-up window "&lt;b&gt;Specify Values from Template Parameters&lt;/b&gt;". In this window specify the parameters like &lt;b&gt;Column Names&lt;/b&gt;, &lt;b&gt;Column Data Type&lt;/b&gt;, &lt;b&gt;NULL&lt;/b&gt;ability, &lt;b&gt;Constraints&lt;/b&gt; etc. as shown in the below screenshot.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsk3pkjSMUKVs6DeIORNZrA1fSmFBf2Yq-yiG_QfTk19F-QgBVRyBGfGVl5WUNhoBCscWLnONqnhAIzGJNUp3VPWha5ES_Y9j5u_kFPe8vXIrUh1JjpCg6GlyHXcD1VCHVIIsc1fDyNJ1h/s1600/SSMS_TemplateExplorer_SpecifyValuesForTemplateParameters.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="337" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsk3pkjSMUKVs6DeIORNZrA1fSmFBf2Yq-yiG_QfTk19F-QgBVRyBGfGVl5WUNhoBCscWLnONqnhAIzGJNUp3VPWha5ES_Y9j5u_kFPe8vXIrUh1JjpCg6GlyHXcD1VCHVIIsc1fDyNJ1h/s400/SSMS_TemplateExplorer_SpecifyValuesForTemplateParameters.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Now when you click OK, the Table Creation Script for the SampleEmployeeTable gets generated as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;textarea cols="70" readonly="readonly" rows="10"&gt;-- ========================================= -- Create table template -- ========================================= USE MyTechnoBook GO  IF OBJECT_ID('dbo.SampleEmployeeTable', 'U') IS NOT NULL   DROP TABLE dbo.SampleEmployeeTable GO  CREATE TABLE dbo.SampleEmployeeTable (  EmployeeId INT NOT NULL,   EmployeeName NVARCHAR(255) NULL,   EmployeeAddress NVARCHAR(512) NULL,      CONSTRAINT PK_SampleEmployeeTable_EmployeeId PRIMARY KEY (EmployeeId) ) GO &lt;/textarea&gt; &lt;br /&gt;
&lt;br /&gt;
Using Template Explorer we can perform the following tasks:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Edit the existing templates to include additional details like parameters, fields, comments, formatting etc.&lt;/li&gt;
&lt;li&gt;Create new templates for commonly used scripts in a module / project so that they can be reused by other team members and also across various modules / projects.&lt;/li&gt;
&lt;li&gt;Rename existing folders / templates as per your convenience (Though this is not required 99.9% of the times as all the folders which ship with SQL Server are named appropriately).&lt;/li&gt;
&lt;li&gt;Create new folders / Renaming existing folders to add new or existing templates.&lt;/li&gt;
&lt;li&gt;Re-organizing the templates by moving them across folders.&lt;/li&gt;
&lt;/ul&gt;Following are few of the advantages / benefits of using Template Explorer:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;These templates act as a quick reference for getting the syntax in the absence of locally installed SQL Server Books Online or Access to Internet.&lt;/li&gt;
&lt;li&gt;Saves time required for formatting the T-SQL code since the templates are pre-formatted hence ensures consistency in terms of formatting across various modules / projects.&lt;/li&gt;
&lt;li&gt;We can share commonly used scripts across all the team members working across modules / projects.&lt;/li&gt;
&lt;/ul&gt;Please let me know your opinion about this article / feature by leaving a comment below.&lt;br /&gt;
&lt;br /&gt;
Here are couple of related links and articles that I have previously published.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/09/sql-query-formatting-standards.html"&gt;T-SQL - Coding Standards &amp;amp; Best Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://mytechnobook.blogspot.com/2009/12/template-packages-in-ssis.html"&gt;Template Packages in SSIS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description><link>http://mytechnobook.blogspot.com/2010/06/t-sql-coding-made-easy-using-inbuilt.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ2QCIQX9RscqkS3x1dgy9rwPN1A4U7zYKfrWAXlLaXqLFZsL5CkwmEATs__TigP55TQy3u5TaKqZtksy7i4Wj8yf7bkmCjm4EHfPy9A4X_SUu-0J_vhDhYZdk4bPijH-hau6UEeOhrVtE/s72-c/SSMS_TemplateExplorer_SQLServer.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-4644467125113344567</guid><pubDate>Wed, 05 May 2010 17:27:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.971+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSMS</category><title>Colored Connections in SQL Server 2008</title><description>&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Have you ever heard of a colored connection in SQL Server? Well, may be few but not everyone reading this blog post would have come across colored connections feature of SQL Server 2008. Lets take a closer look at colored connections feature of SQL Server 2008 Management Studio in this article.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Well, as we all know while laying electric cables / wiring the entire house / campus, various colored cables / wires are used. The main purpose of this is to be able to differentiate the cables using colors both at the time of initial setup as well as during repair / maintenance. Colored Connections in SQL Server also work pretty much on the similar lines.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In SQL Server 2008 Management Studio (SSMS), while connecting to a server / database in the "Connect to Server" window where we enter the server details and the credentials, there is an "Option" button at the Right-Bottom corner as shown in the below window.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU8z0HW60X1hZmKFUtWxDQSNQggJXJgqa7fECWpbGy7NTDxQB1X4mqL_sK12RN3vGvp4bLhsOLKRgGveOdLY8x8009AxTM4YWCak6IWh86ob9FoF5JrT5xQNB5nbrVSoBPF5O0spKPDNa9/s1600/SSMS_Connect_to_Server.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="302" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU8z0HW60X1hZmKFUtWxDQSNQggJXJgqa7fECWpbGy7NTDxQB1X4mqL_sK12RN3vGvp4bLhsOLKRgGveOdLY8x8009AxTM4YWCak6IWh86ob9FoF5JrT5xQNB5nbrVSoBPF5O0spKPDNa9/s400/SSMS_Connect_to_Server.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In the above window click on "Options&amp;gt;&amp;gt;" button &amp;amp; go to "Connection Properties" tab and check the "Use Custom Color" check box. Click on "Select..." button to select any color of your choice from the list of available colors or you can define your own custom color as shown in the below screenshot.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCiO0Tjw92D98Mm02Dps7zlbWlgNel4xpDjJU090K0Yg7c4lOFu66disIdj6ZCcdIb2mTbQL9k9l2DzdW1APDnn7IVIvgMhTFECDGR6uIqh4Fv2mWj99nRdTcN65ES6F2PLuX8ZNNzDa3i/s1600/SSMS_Connect_to_Server_WIth_Colored_Connection.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCiO0Tjw92D98Mm02Dps7zlbWlgNel4xpDjJU090K0Yg7c4lOFu66disIdj6ZCcdIb2mTbQL9k9l2DzdW1APDnn7IVIvgMhTFECDGR6uIqh4Fv2mWj99nRdTcN65ES6F2PLuX8ZNNzDa3i/s400/SSMS_Connect_to_Server_WIth_Colored_Connection.PNG" width="337" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In the above screenshot I have selected the color green since its a development server and one can do anything &amp;amp; everything as long as the database does not conflict with other developers.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;With the use of this feature one can give distinct color to each of the servers / databases that are frequently used like Dev, Test, UAT / Pre-Prod, Prod etc as shown in the below screenshot.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyP3xdUtRiEQcBJBuUTPnofww0FMhkU1xJmrdL94JTybMBhc_QvQeH_OZRGzmh_HLzGR2qxKcDYoqK-pJJvdzn5GMLilyOWdquaQG-KRfIV7CJFj83qxhiAyo8sF09H0lty50_qdCBrU98/s1600/Colored_Connections_In_SQL_Server_2008_SSMS.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyP3xdUtRiEQcBJBuUTPnofww0FMhkU1xJmrdL94JTybMBhc_QvQeH_OZRGzmh_HLzGR2qxKcDYoqK-pJJvdzn5GMLilyOWdquaQG-KRfIV7CJFj83qxhiAyo8sF09H0lty50_qdCBrU98/s400/Colored_Connections_In_SQL_Server_2008_SSMS.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;This color coding / coloring a connection in SQL Server Management Studio reminds the developers / testers etc about the environment in which they are working, so that they can pay necessary attention before firing any query.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Lastly, there is a feature in SQL Server Management Studio (SSMS) which is called "Registered Servers" / "Server Registration" which helps us in registering most commonly used servers / databases. I would prefer to keep all my frequently used servers / databases registered and grouped into separate Server Groups with a different color for each type of connection as shown in the below screenshot.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQj1jcSVy3THAIxZ-d1-titUmDcC1BkDImRbpNIDwT9E-s8ekbrZRXM-saR1qhYzUNC8CphY88nLz7_UY9XwuYt33cTExQeL2_6jHGKZvo7HyTteGCLjct51PKUacPnpT8saY8hgK1U1Gq/s1600/Registered_Servers_In_SQL_Server_SSMS.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQj1jcSVy3THAIxZ-d1-titUmDcC1BkDImRbpNIDwT9E-s8ekbrZRXM-saR1qhYzUNC8CphY88nLz7_UY9XwuYt33cTExQeL2_6jHGKZvo7HyTteGCLjct51PKUacPnpT8saY8hgK1U1Gq/s400/Registered_Servers_In_SQL_Server_SSMS.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Well, that is all about Colored Connections, which is a very nice feature introduced in SQL Server 2008 Management Studio and also a little bit on the best practices of Registering / Grouping frequently used Servers / Databases in SQL Server.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Let me know if you liked this post by leaving a comment below.&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/05/colored-connections-in-sql-server-2008.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiU8z0HW60X1hZmKFUtWxDQSNQggJXJgqa7fECWpbGy7NTDxQB1X4mqL_sK12RN3vGvp4bLhsOLKRgGveOdLY8x8009AxTM4YWCak6IWh86ob9FoF5JrT5xQNB5nbrVSoBPF5O0spKPDNa9/s72-c/SSMS_Connect_to_Server.PNG" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-762615716435784199</guid><pubDate>Tue, 30 Mar 2010 16:15:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.972+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>T-SQL - Coding Standards &amp; Best Practices</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;We see a lots of articles on the net and lots of documents are prepared by different project teams in the industry to present / capture the conventions, coding standards etc. However in reality there is nothing like a standard / convention as such in most cases. Conventions / Standards are defined to ensure consistency in the coding / documentation across various modules / projects.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Having said that, here are few of the conventions / standards that I use while writing T-SQL queries / functions / SPs etc.&lt;/span&gt;&lt;/div&gt;&lt;ul style="text-align: justify;"&gt;&lt;li style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Always type the SQL Keywords in CAPITAL Letters.&lt;/span&gt;&lt;/li&gt;
&lt;li style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Use proper case while typing names of any database objects/entities. Usually database objects should be named using InitCap / Camel Case.&lt;/span&gt;&lt;/li&gt;
&lt;li style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Use proper indentation.&lt;/span&gt;&lt;/li&gt;
&lt;li style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Use Comments wherever necessary.&lt;/span&gt;&lt;/li&gt;
&lt;li style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Name the table aliases by concatenating the first letter of all the words in the name of the table. &lt;u&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/u&gt;: If the table name is FactInternetSales then one of the possible alias is FIS. Define the aliases considering the conflicts if any with the other table aliases.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;While executing stored procedures using "EXEC" command use the variable names while passing input values to the Stored Procedure (SP).&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br style="font-family: inherit;" /&gt;&lt;/span&gt;&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Bad Example&lt;/b&gt;&lt;/u&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: small;"&gt;&lt;span style="color: blue;"&gt;USE&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;AdventureWorksDW&lt;/span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;EXEC&lt;/span&gt;&amp;nbsp;&lt;span style="color: #ff0080;"&gt;&lt;b&gt;sp_spaceused&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'FactInternetSales'&lt;/span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Good Example&lt;/b&gt;&lt;/u&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: small;"&gt;&lt;span style="color: blue;"&gt;USE&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;AdventureWorksDW&lt;/span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;span class="Apple-converted-space"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;EXEC&lt;/span&gt;&amp;nbsp;&lt;span style="color: #ff0080;"&gt;&lt;b&gt;sp_spaceused&lt;/b&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #8000ff;"&gt;@objname&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'FactInternetSales'&lt;/span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj03_9-6_Zh2x4RG7QUE4vQRb1g6WraXEpo5QrCk9n_Qz1ceTfH1a8x_Wf1V11jjUtL4ev7pEvDYRu6ZZcgJ9kA2e4ZidAHDUS_GZBsMaOIpqUnGt98IO6L6GBPl4UcylLPaFXZaHDsWvy2/s1600-h/MostCommonSQLStatements.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj03_9-6_Zh2x4RG7QUE4vQRb1g6WraXEpo5QrCk9n_Qz1ceTfH1a8x_Wf1V11jjUtL4ev7pEvDYRu6ZZcgJ9kA2e4ZidAHDUS_GZBsMaOIpqUnGt98IO6L6GBPl4UcylLPaFXZaHDsWvy2/s400/MostCommonSQLStatements.JPG" /&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;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Above snapshot shows few of the most commonly used T-SQL Statements.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;These conventions are purely based on my comfort level and there is no hard &amp;amp; fast rule that these are followed / should be following widely in the industry. One can define their own standards / conventions based on their comfort level to ensure consistency.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;This blog post is updated as and when I find something interesting which  I feel like adopting as part of my coding. &lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2009/09/sql-query-formatting-standards.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj03_9-6_Zh2x4RG7QUE4vQRb1g6WraXEpo5QrCk9n_Qz1ceTfH1a8x_Wf1V11jjUtL4ev7pEvDYRu6ZZcgJ9kA2e4ZidAHDUS_GZBsMaOIpqUnGt98IO6L6GBPl4UcylLPaFXZaHDsWvy2/s72-c/MostCommonSQLStatements.JPG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-57077797658855615</guid><pubDate>Sun, 21 Mar 2010 16:18:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.973+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSRS</category><title>How to Display Report Execution Time in Reporting Services (SSRS)</title><description>&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Often in Reporting Applications, faster rendering of reports is very essential. Especially in case of Operational Reporting Systems with large number of concurrent users, Reporting Rendering SLA is defined during the requirement phase of the project and is a very critical component of the Requirements / Reporting Application.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In these kind of solutions its good to display the total time a report takes for rendering from the moment the View Report button is clicked in the report manager. This feature can be used as a means of communicating the exact report rendering time to the users and also to identify the reports / scenarios which are exceeding / missing the rendering SLA.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now let us see how to display the execution time in an SSRS report.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Since SSRS uses functions based on .Net framework we can use the following expression to get the report rendering time in seconds:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;b style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Similary to display the time in terms of &lt;b&gt;minutes&lt;/b&gt; and &lt;b&gt;hours&lt;/b&gt; we can just replace &lt;b&gt;Seconds&lt;/b&gt; in the above expression with &lt;b&gt;Minutes&lt;/b&gt; and &lt;b&gt;Hours&lt;/b&gt; respectively.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Though execution time in terms of Hours is rarely / never used.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To make the display more user friendly or more presentable we can use the following expression:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;"&gt;&lt;b&gt;="Execution Time: " +&lt;br /&gt;
CStr(System.DateTime.Now.Subtract(Globals!ExecutionTime).Hours) + " hour(s)" + " , " +&lt;br /&gt;
CStr(System.DateTime.Now.Subtract(Globals!ExecutionTime).Minutes) + " minute(s)" + ", " +&lt;br /&gt;
CStr(System.DateTime.Now.Subtract(Globals!ExecutionTime).Seconds) + " second(s)"&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;b style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here is a sample report displaying the execution time in terms of Hours, Minutes and Seconds as shown below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlfyqCPGrX7TOIuhaJ0v9_J7G3dlaig0uRaXxp1Q2DGUJNw5GZH-BC9jyicQNGUQ_yjuZrv6kUpa1Zqu-R3w8JrDMKRMZjfbup1x-6gi9vEUalKF95L7QKOJdJ1n10AfBwLmQhi6cywxWR/s1600-h/Displaying_Report_Execution_Time_In_SSRS.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="137" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlfyqCPGrX7TOIuhaJ0v9_J7G3dlaig0uRaXxp1Q2DGUJNw5GZH-BC9jyicQNGUQ_yjuZrv6kUpa1Zqu-R3w8JrDMKRMZjfbup1x-6gi9vEUalKF95L7QKOJdJ1n10AfBwLmQhi6cywxWR/s400/Displaying_Report_Execution_Time_In_SSRS.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;As shown in the above screenshot the report takes 1 Min 3 Seconds or 63 Seconds to render.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now let us verify how accurate this number is by querying the SSRS report tables which hold the history / log of a report execution.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;I ran the following query in the ReportServer database:&lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; &lt;span style="color: blue;"&gt;TOP&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;1&lt;/span&gt; &lt;span style="color: maroon;"&gt;ReportID&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;span style="color: maroon;"&gt; TimeStart&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;TimeEnd&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;TimeDataRetrieval&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;TimeProcessing&lt;/span&gt;&lt;span style="color: silver;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;TimeRendering&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;TimeDataRetrieval&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TimeProcessing&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TimeRendering&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TotalRenderingTime&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;FROM &lt;/span&gt;&lt;span style="color: maroon;"&gt;dbo&lt;/span&gt;&lt;span style="color: silver;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;ExecutionLog&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;WHERE &lt;/span&gt;&lt;span style="color: maroon;"&gt;ReportID&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'90ABF38F-E280-4B75-B807-343AFB5FE696'&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;ORDER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;BY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TimeStart&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;DESC&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;And here are the results of the above query:&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijJcB9mjp0LvqdRUNH3kvfDYaFpwl_viRRVunI2XO-xXYO_u9QrNQZO3dkyZdvqVgfIQWBlJVHPYT-rrguEiT5esjYotmQSG_UBGOC1ARjmqOJKZ6zmnIvG_TceSNna7z_9fBt3RmlFuJX/s1600-h/Displaying_Report_Execution_Time_In_SSRS_2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijJcB9mjp0LvqdRUNH3kvfDYaFpwl_viRRVunI2XO-xXYO_u9QrNQZO3dkyZdvqVgfIQWBlJVHPYT-rrguEiT5esjYotmQSG_UBGOC1ARjmqOJKZ6zmnIvG_TceSNna7z_9fBt3RmlFuJX/s400/Displaying_Report_Execution_Time_In_SSRS_2.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;From the above screenshot we can see that the total time is 63172 milliseconds or ~63 Seconds or 1 Min &amp;amp; 3 Seconds, which is same as the Execution Time displayed in the previous screenshot.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Please let me know your comments / opinions about this article by leaving a comment below.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Note&lt;/b&gt;&lt;/u&gt;: This demonstration is tested in SSRS 2008. The implementation should be almost the same for SSRS 2005 as well.&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/03/how-to-display-report-execution-time-in.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlfyqCPGrX7TOIuhaJ0v9_J7G3dlaig0uRaXxp1Q2DGUJNw5GZH-BC9jyicQNGUQ_yjuZrv6kUpa1Zqu-R3w8JrDMKRMZjfbup1x-6gi9vEUalKF95L7QKOJdJ1n10AfBwLmQhi6cywxWR/s72-c/Displaying_Report_Execution_Time_In_SSRS.PNG" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-1456557074309900912</guid><pubDate>Sun, 07 Mar 2010 16:55:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.974+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Query to Select a Random Record from a Table in SQL Server</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Often people struggle to get a RANDOM record from a table in SQL Server. There is a function in SQL Server RAND() which generates Random Numbers. However this function does not work as expected while selecting a RANDOM row from a table in SQL Server.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To address this issue, there is a workaround to select a RANDOM row from a table in SQL Server. Let us see how we can achieve this using the following demonstration.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Create a Temp Table using the following query: &lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;br /&gt;
&lt;span style="color: blue; font-size: small;"&gt;CREATE&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;TABLE&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;#TempTable&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;&lt;i&gt;INT &lt;/i&gt;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;NOT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;NULL&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;&lt;i&gt;NVARCHAR&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;20&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;) &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;NOT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;NULL&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;)&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now insert some sample data into the Temp Table using the  following query:&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;INSERT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;INTO&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;#TempTable&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;)&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt; &lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;FROM&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;1&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;1'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;2 &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;2'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;3 &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;3'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;4 &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;4'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;5 &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;5'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;6 &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;6'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt; &lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;7&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;7'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;8&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;8'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;9&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;9'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;UNION&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;ALL&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;10&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;IntValue&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;,&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: red; font-size: small;"&gt;'String&amp;nbsp;Value&amp;nbsp;10'&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;AS&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StrValue&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;)&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;StaticData&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now run the following queries to see how 2 RANDOM rows are selected from Temp Table every time you run these queries.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;br /&gt;
&lt;span style="color: blue; font-size: small;"&gt;SELECT&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;TOP&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-size: small;"&gt;2&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: silver; font-size: small;"&gt;*&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;FROM&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;#TempTable&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;ORDER&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-size: small;"&gt;BY&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: magenta; font-size: small;"&gt;&lt;i&gt;NEWID&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="color: maroon; font-size: small;"&gt;)&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt; &lt;span style="color: blue; font-size: small;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; &lt;span style="color: blue;"&gt;TOP&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;2&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;*&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: maroon;"&gt;#TempTable&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;ORDER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;BY&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta;"&gt;&lt;i&gt;NEWID&lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;/i&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
Here is the output of the above queries. Run these queries a couple times to see the difference in the number of selected rows every time the above queries are run.&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DaxJAKiB9WP2h33y2FghApSExoybL0rC_3_R7OskbgHoGFDywzgFI-YYWk8aUqweff2FUFgOoQylZKwJjTc2lR4OlNIA-sxNT1A5Z04zW5lBOoh0FlLsGWTNt9ejBqX81mFT3FKZKNsa/s1600-h/Select_Random_Record_from_a_Table_+In_SQL_Server.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="255" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DaxJAKiB9WP2h33y2FghApSExoybL0rC_3_R7OskbgHoGFDywzgFI-YYWk8aUqweff2FUFgOoQylZKwJjTc2lR4OlNIA-sxNT1A5Z04zW5lBOoh0FlLsGWTNt9ejBqX81mFT3FKZKNsa/s400/Select_Random_Record_from_a_Table_+In_SQL_Server.PNG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="text-align: justify;"&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;
Find this post useful ? Please do let me know by leaving a comment below :-)&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/03/query-to-select-random-record-from.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5DaxJAKiB9WP2h33y2FghApSExoybL0rC_3_R7OskbgHoGFDywzgFI-YYWk8aUqweff2FUFgOoQylZKwJjTc2lR4OlNIA-sxNT1A5Z04zW5lBOoh0FlLsGWTNt9ejBqX81mFT3FKZKNsa/s72-c/Select_Random_Record_from_a_Table_+In_SQL_Server.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-7926305089168764062</guid><pubDate>Fri, 19 Feb 2010 17:40:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.974+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>Query To Get The COUNT of Records in All The Tables in a Database in SQL Server</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Often we take the &lt;b&gt;COUNT&lt;/b&gt; of records in a table or many of the times all the tables in a database. We might need to get the &lt;b&gt;COUNT&lt;/b&gt; of records in all the tables especially for validation purposes.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;For instance when you are loading the data into your Staging Database in an incremental fashion, you need to do few checks to make sure that the incremental logic is working fine. As part of this, one of the most basic checks is to first get the &lt;b&gt;COUNT&lt;/b&gt; of records from all the tables in Source &amp;amp; Staging Databases and compare the &lt;b&gt;COUNT&lt;/b&gt;s.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here is a very simple way to get the &lt;b&gt;COUNT&lt;/b&gt; of records from all the tables in a database. Run the following query in the database in which you need to get the &lt;b&gt;COUNT&lt;/b&gt;s of all the tables.&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt; &lt;span style="color: #8000ff;"&gt;@QueryString&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;&lt;i&gt;NVARCHAR&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: blue;"&gt;MAX&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt; &lt;span style="color: #8000ff;"&gt;@QueryString&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: magenta;"&gt;&lt;i&gt;COALESCE&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: #8000ff;"&gt;@QueryString&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'&amp;nbsp;UNION&amp;nbsp;ALL&amp;nbsp;'&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;span style="color: red;"&gt;''&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'SELECT&amp;nbsp;'&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;''''&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TABLE_SCHEMA&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'.'&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TABLE_NAME&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;''''&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'&amp;nbsp;AS&amp;nbsp;TableName,&amp;nbsp;COUNT(1)&amp;nbsp;AS&amp;nbsp;RecordCount&amp;nbsp;FROM&amp;nbsp;'&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TABLE_SCHEMA&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'.'&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;+&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TABLE_NAME&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: maroon;"&gt;INFORMATION_SCHEMA&lt;/span&gt;&lt;span style="color: silver;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;TABLES&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;WHERE &lt;/span&gt;&lt;span style="color: maroon;"&gt;TABLE_TYPE&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'BASE&amp;nbsp;TABLE'&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;ORDER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;BY &lt;/span&gt;&lt;span style="color: maroon;"&gt;TABLE_SCHEMA&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;TABLE_NAME&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: x-small;"&gt;&lt;span style="color: blue; font-size: small;"&gt;EXEC&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #ff0080; font-size: small;"&gt;&lt;b&gt;Sp_executesql&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #8000ff; font-size: small;"&gt;@QueryString&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When you run the above query in AdventureWorksDW database then the results will be as shown below (Tables/Counts might slightly vary depending on the version of AdventureWorksDW).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP2R3KbZmfpmL8QChBDPBdaS61u-YsD4FTykeMfUWuaIjiJTo7uDkY2tAE988SMk27gdnkjIexys5Ikt1dEdo-m2ZxB9CFmfkmN3L_iH-9PU3uKpmtMtQde5jDDe9D06pB1RqEL8qFE7bO/s1600-h/COUNT_of_Records_in_All_The_Tables_in_AdventureWorksDW.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP2R3KbZmfpmL8QChBDPBdaS61u-YsD4FTykeMfUWuaIjiJTo7uDkY2tAE988SMk27gdnkjIexys5Ikt1dEdo-m2ZxB9CFmfkmN3L_iH-9PU3uKpmtMtQde5jDDe9D06pB1RqEL8qFE7bO/s400/COUNT_of_Records_in_All_The_Tables_in_AdventureWorksDW.PNG" width="367" /&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Feel free to leave your comments if you like this post.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/02/query-to-get-count-of-records-in-all.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP2R3KbZmfpmL8QChBDPBdaS61u-YsD4FTykeMfUWuaIjiJTo7uDkY2tAE988SMk27gdnkjIexys5Ikt1dEdo-m2ZxB9CFmfkmN3L_iH-9PU3uKpmtMtQde5jDDe9D06pB1RqEL8qFE7bO/s72-c/COUNT_of_Records_in_All_The_Tables_in_AdventureWorksDW.PNG" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-3476208638962148672</guid><pubDate>Sun, 14 Feb 2010 12:04:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.975+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Issues N Resolution</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><title>Error - The path is not valid. The path must confirm to Uniform Naming Conventions (UNC) format.</title><description>&lt;span style="font-family: inherit; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Recently I started looking into one of the great features of Reporting Services (SSRS 2008) and that is &lt;b&gt;Subscriptions&lt;/b&gt;. A Subscription is a feature in SSRS to deliver a report to the users at specified time in their intended format.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;There are basically two types of Subscriptions - &lt;b&gt;Standard&lt;/b&gt; and &lt;b&gt;Data-Driven&lt;/b&gt; Subscriptions.&amp;nbsp; Each of these Subscription types offer delivery options like Delivery via E-Mail, Delivery to a specified location on the File System etc. These Subscriptions also offer various rendering/delivery formats like Excel, PDF etc. Basically all the exporting formats that are available in Report Server/Manager. However getting into the details of Subscriptions is out of scope of this article. More information on this topic can be found on msdn at the following location:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms155911%28SQL.90%29.aspx"&gt;&lt;span style="font-size: small;"&gt;http://msdn.microsoft.com/en-us/library/ms155911%28SQL.90%29.aspx&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Today I was working on Subscription with Windows File Share/File System delivery option. While configuring this option, we need to specify the location to which the report need to be delivered/saved on the file system. I gave the location for delivery as a local drive on my personal computer.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When I gave the local path as "F:\Datta\MyTechnoBook - Files\" and got an error as &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="color: red; font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The path is not valid. The path must confirm to Uniform Naming Conventions (UNC) format.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8UN6Es83XSJqjr_OIQJpTO1TuM_x0JqXrKSYu23Z46AhEafNFSAbFo6RQKyOEkYypczWajm8xzixbfLOihDkYEFunF7Bku397ePM4FFEiLgW0HJhsHPregIkNr8kbe7_DZffjFYeoeiDf/s1600-h/Error_While_Creating_Subscriptions_In_SSRS.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8UN6Es83XSJqjr_OIQJpTO1TuM_x0JqXrKSYu23Z46AhEafNFSAbFo6RQKyOEkYypczWajm8xzixbfLOihDkYEFunF7Bku397ePM4FFEiLgW0HJhsHPregIkNr8kbe7_DZffjFYeoeiDf/s400/Error_While_Creating_Subscriptions_In_SSRS.PNG" width="400" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;This error indicates that the path should be provided in the form of Uniform Naming Conventions (UNC) format. Or in simple terms we need to provide the path in the format of Shared Drive as follows:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;b&gt;&lt;a href="http://%5c%5cservername%5cfolderlocation%5c/"&gt;&lt;span style="font-size: small;"&gt;\\ServerName\FolderLocation\&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When I gave the location as "&lt;a href="http://%5c%5csindol%5cf$%5cdatta%5cmytechnobook%20-%20files%5c/"&gt;\\SINDOL\F$\Datta\MyTechnoBook - Files\&lt;/a&gt;" it solved the error.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Hope you find this article helps! If yes then do leave your comments :-)&lt;/span&gt;&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/02/error-path-must-confirm-to-uniform.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8UN6Es83XSJqjr_OIQJpTO1TuM_x0JqXrKSYu23Z46AhEafNFSAbFo6RQKyOEkYypczWajm8xzixbfLOihDkYEFunF7Bku397ePM4FFEiLgW0HJhsHPregIkNr8kbe7_DZffjFYeoeiDf/s72-c/Error_While_Creating_Subscriptions_In_SSRS.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-2487427409004066914</guid><pubDate>Sat, 06 Feb 2010 17:45:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.976+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><title>How to Copy Table Structure With Or Without Data in SQL Server</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Often while working with T-SQL we create copies of tables as a backup of the original/base table so that we can make changes to the data in the original/base table for testing purposes, and revert back to the backup table if needed. SQL Server provides few Key Words or options to perform this operation.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;However there are few key differences to note between the original table and the backup table while creating the copies of the tables With/Without data, and these differences could be really important to consider especially when we decide to drop the original table since you have taken the backup. Before you drop the original table, be careful and think twice before you do this! Read through this article to know more about the differences between the Original Table and the Copy of the table. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now in this article lets take a look at how to create a copy of a table in &lt;b&gt;No Time&lt;/b&gt; in either of the following &lt;/span&gt;&lt;span style="font-size: small;"&gt;ways:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: inherit;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Copy Table Structure With Data&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Copy Only Table Structure Without Data&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Create a sample table as follows and call it as ExistingEmployeeTable.&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Table */&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;CREATE&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style="color: maroon;"&gt;EmployeeId&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;i&gt;INT&lt;/i&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;IDENTITY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;NOT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;NULL&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;i&gt;NVARCHAR&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;100&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;NOT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;NULL&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;i&gt;INT&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;G&lt;/span&gt;O&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Create a Primary Key on EmployeeId.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Primary Key */&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;ALTER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style="color: blue;"&gt;ADD&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;CONSTRAINT&lt;/span&gt; &lt;span style="color: maroon;"&gt;PK_ExistingEmployeeTable_EmployeeId&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;PRIMARY&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;KEY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;EmployeeId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now create another table called ExistingManagerTable with ManagerId as Primary Key.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Table */&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;CREATE&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingManagerTable&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;i&gt;INT &lt;/i&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;IDENTITY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: maroon;"&gt;) &lt;/span&gt;&lt;span style="color: blue;"&gt;NOT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;NULL&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;span style="color: maroon;"&gt;ManagerName&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;i&gt;NVARCHAR&lt;/i&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: black;"&gt;100&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt; &lt;span style="color: blue;"&gt;NOT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;NULL&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;G&lt;/span&gt;O&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Primary Key */&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;ALTER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingManagerTable&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style="color: blue;"&gt;ADD&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;CONSTRAINT&lt;/span&gt; &lt;span style="color: maroon;"&gt;PK_ExistingManagerTable_ManagerId&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;PRIMARY&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;KEY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;G&lt;/span&gt;O&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now create a Foreign Key table in ExistingEmployeeTable on ManagerId and also create a Non Clustered Index on ManagerId.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Foreign Key */&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;ALTER&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;TABLE&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style="color: blue;"&gt;ADD&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;CONSTRAINT&lt;/span&gt; &lt;span style="color: maroon;"&gt;FK_ExistingEmployeeTable_ManagerId&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;FOREIGN&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;KEY&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;REFERENCES&lt;/span&gt;&amp;nbsp;&lt;span style="color: maroon;"&gt;ExistingManagerTable&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;G&lt;/span&gt;O&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: #38761d;"&gt;/* Create Non Unique Non Clustered Index */&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;CREATE&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;NONCLUSTERED&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;INDEX&lt;/span&gt; &lt;span style="color: maroon;"&gt;IDX_NU_NCL_ExistingEmployeeTable_ManagerId&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;ON&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;G&lt;/span&gt;O&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now lets take a look at the structure of the two newly created tables as below.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB-H4g0vQvX0S2DaVtNKKDEN0Y8bpxEN6mz-2Lsz5xQjZvvQFlZ_-U5F-vpuAqgMyDP9WPDWk-KrB1jcsyMdS6YkBGWGX9o4tbld_HRcHgdkRJ1mC9iIGYEwyuEDqb6GWhTwhbxSNwDRY2/s1600-h/Copying_Table_Structures_In_SQL_Server_01.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="436" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB-H4g0vQvX0S2DaVtNKKDEN0Y8bpxEN6mz-2Lsz5xQjZvvQFlZ_-U5F-vpuAqgMyDP9WPDWk-KrB1jcsyMdS6YkBGWGX9o4tbld_HRcHgdkRJ1mC9iIGYEwyuEDqb6GWhTwhbxSNwDRY2/s640/Copying_Table_Structures_In_SQL_Server_01.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Figure 1.0&lt;/b&gt;&lt;/u&gt; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now lets us insert some sample data.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;INSERT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingManagerTable&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;ManagerName&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'John'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerName&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'James'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerName&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Michael'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;ManagerName&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: blue;"&gt;INSERT&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&lt;span style="color: maroon;"&gt;(&lt;/span&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;span style="color: maroon;"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Robert'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: black;"&gt;1 &lt;/span&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Daniel'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: black;"&gt;2&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'David'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: black;"&gt;3&lt;/span&gt; &lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Steven'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: silver;"&gt;, &lt;/span&gt;&lt;span style="color: black;"&gt;2 &lt;/span&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;UNION&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: red;"&gt;'Albert'&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;EmployeeName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: silver;"&gt;,&lt;/span&gt; &lt;span style="color: black;"&gt;3 &lt;/span&gt;&lt;span style="color: blue;"&gt;AS&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: Courier New; font-size: small;"&gt;&lt;span style="color: maroon;"&gt;ManagerId&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: blue;"&gt;GO&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now lets create a copy of the ExistingEmployeeTable along With Data as follows. You can either create a Physical Table or a Temporary Table based on your needs.&lt;span style="color: green; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="color: green; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;span style="color: green; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;i&gt;/*&amp;nbsp;Create&amp;nbsp;Copy&amp;nbsp;of&amp;nbsp;Table&amp;nbsp;With&amp;nbsp;Data&amp;nbsp;*/&lt;/i&gt;&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt; &lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;SELECT&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: silver; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;*&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt; &lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;INTO &lt;/span&gt;&lt;span style="color: maroon; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;dbo&lt;/span&gt;&lt;span style="color: silver; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;.&lt;/span&gt;&lt;span style="color: maroon; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;NewEmployeeTable&lt;/span&gt;&lt;br style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;" /&gt; &lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;FROM&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt; &lt;/span&gt;&lt;span style="color: maroon; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;dbo&lt;/span&gt;&lt;span style="color: silver; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;.&lt;/span&gt;&lt;span style="color: maroon; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ExistingEmployeeTable&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;You can also create a copy of the ExistingEmployeeTable Without Data as follows. Again here you can create either a Physical Table or a Temporary Table.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-family: Courier New; font-size: small;"&gt; &lt;span style="color: green;"&gt;&lt;i&gt;/*&amp;nbsp;Create&amp;nbsp;Copy&amp;nbsp;of&amp;nbsp;Table&amp;nbsp;Without&amp;nbsp;Data&amp;nbsp;*/&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;*&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;INTO&lt;/span&gt; &lt;span style="color: maroon;"&gt;dbo&lt;/span&gt;&lt;span style="color: silver;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;#NewEmployeeTable&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;FROM&lt;/span&gt; &lt;span style="color: maroon;"&gt;dbo&lt;/span&gt;&lt;span style="color: silver;"&gt;.&lt;/span&gt;&lt;span style="color: maroon;"&gt;ExistingEmployeeTable&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: blue;"&gt;WHERE &lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&amp;nbsp;&lt;span style="color: silver;"&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;In this query SQL Server creates a copy of the table structure, but since the condition in the WHERE clause is FALSE, the data will not be copied to the newly created table.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now lets take a look at the structure of the backup/newly created NewEmployeeTable table.&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz2hPbWABGfD2Pb_peYmQGGJMiyGkCbVbeS7ZBF6oSrHvDdvESyQ8aDjJGUyZTZwEsRYtaxnBBQc0dCHpS66z6JB-atyrTTJa42QH3K-LfhCLqT-46mFYdI3DIKXZNmJsUN93uV-wYGEwm/s1600-h/Copying_Table_Structures_In_SQL_Server_02.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz2hPbWABGfD2Pb_peYmQGGJMiyGkCbVbeS7ZBF6oSrHvDdvESyQ8aDjJGUyZTZwEsRYtaxnBBQc0dCHpS66z6JB-atyrTTJa42QH3K-LfhCLqT-46mFYdI3DIKXZNmJsUN93uV-wYGEwm/s640/Copying_Table_Structures_In_SQL_Server_02.PNG" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Figure 2.0&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;Now compare the table structures of ExistingEmployeeTable (Old Table) &amp;amp; NewEmployeeTable (New Table), and here are few of the key differences to note:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol&gt;&lt;span style="font-size: small;"&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Primary &amp;amp; Foreign Keys are not created in the Newly Created Table (NewEmployeeTable)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Indexes are not created in the Newly Created Table (NewEmployeeTable)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-size: small;"&gt;Default/Check Constraints are not created in the Newly Created Table (NewEmployeeTable)&lt;/span&gt;&lt;/li&gt;
&lt;/span&gt;&lt;/ol&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: small;"&gt;These are few most important differences which one should note before deciding to drop the original table after taking a backup of the table using SELECT * INTO statement.&lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;</description><link>http://mytechnobook.blogspot.com/2010/02/how-to-copy-table-structure-with-or.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB-H4g0vQvX0S2DaVtNKKDEN0Y8bpxEN6mz-2Lsz5xQjZvvQFlZ_-U5F-vpuAqgMyDP9WPDWk-KrB1jcsyMdS6YkBGWGX9o4tbld_HRcHgdkRJ1mC9iIGYEwyuEDqb6GWhTwhbxSNwDRY2/s72-c/Copying_Table_Structures_In_SQL_Server_01.PNG" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-4967255675978234165</guid><pubDate>Sun, 31 Jan 2010 18:31:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.977+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">About Me</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><title>Happy Birthday To Me :)</title><description>&lt;div style="text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Today, 1st Feb 2010 is a very special day for me. Guess why ? &lt;b style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;It's my B'day today!!!&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Happy B'day to me&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Happy B'day to me&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Happy B'day dear Datta!!!&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: small;"&gt;Happy B'day to me :) &lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNbByVa_LwnN58xrQCXva8rwGfP-kn3qOSm-NEosQCoR6svonMoHZjzf5ZfI1Va62D_aufpuDz3qOYY4VZUskrmWmt9jMIqMK9yIQxlNYIa6fY4lR_vjL64Y_kSH6FHvBR3uyYREJnOciS/s1600-h/Happy_Birthday.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNbByVa_LwnN58xrQCXva8rwGfP-kn3qOSm-NEosQCoR6svonMoHZjzf5ZfI1Va62D_aufpuDz3qOYY4VZUskrmWmt9jMIqMK9yIQxlNYIa6fY4lR_vjL64Y_kSH6FHvBR3uyYREJnOciS/s400/Happy_Birthday.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Today is very special day in another aspect, that is the date today is &lt;b&gt;01022010&lt;/b&gt; (DDMMYYYY). If you read it Left-to-Right or Right-to-Left its the same :)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Once again wishing myself a &lt;b style="font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;"&gt;Very Happy B'day!!!&lt;/b&gt;&lt;/span&gt; &lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/02/happy-birthday-to-me.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNbByVa_LwnN58xrQCXva8rwGfP-kn3qOSm-NEosQCoR6svonMoHZjzf5ZfI1Va62D_aufpuDz3qOYY4VZUskrmWmt9jMIqMK9yIQxlNYIa6fY4lR_vjL64Y_kSH6FHvBR3uyYREJnOciS/s72-c/Happy_Birthday.jpg" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1320476894466593706.post-2235664134405222549</guid><pubDate>Sat, 23 Jan 2010 12:18:00 +0000</pubDate><atom:updated>2010-11-30T01:15:44.978+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">-- All Blog Posts --</category><category domain="http://www.blogger.com/atom/ns#">Code Snippets</category><category domain="http://www.blogger.com/atom/ns#">MyTechnoBook</category><category domain="http://www.blogger.com/atom/ns#">SSRS</category><title>Formatting Minutes as Hours and Minutes in SQL Server Reporting Services (SSRS)</title><description>&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Today I was working on an SSRS report for one of our clients and came across a specific formatting requirement around formatting Minutes as HH:MM. Browsed a little bit but could not get it working. Then sat for a while &amp;amp; tried few tricks by playing around with the expressions and finally got it working :-)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here is how I solved the problem.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The data available in the database is numeric and represents Total Minutes. When I initially wrote some expressions to derive Hours and Minutes from the Total Minutes I was able to get the data something like this:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;10 Minutes -&amp;gt; &lt;b&gt;0:10&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;65 Minutes -&amp;gt; &lt;b&gt;1:5&lt;/b&gt; etc&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;However the need was to display the data something like below:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;10 Minutes -&amp;gt; &lt;b&gt;00:10&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;65 Minutes -&amp;gt; &lt;b&gt;01:05&lt;/b&gt; etc&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now to get this formatting, first split the Minutes into Hours &amp;amp; Remaining Minutes as follows:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Hours part of TotalMinutes = &lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Floor(Fields!Minutes.Value/60)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Remaining Minutes part of TotalMinutes = &lt;b style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;Fields!Minutes.Value Mod 60&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now to display the data in the intended format put the following expression in the textbox of the detailed row of the Table/Matrix of SSRS:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;=Format(Floor(Fields!Minutes.Value/60),"00") + ":" + Format((Fields!Minutes.Value Mod 60),"00")&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="font-family: inherit; text-align: left;"&gt;&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Below is a sample report with formatted minutes.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiE9URqBDn9oQyH3BnlJpl2JBSGzG8pyp30VhY9Vp81WZmyTAHWl4DPwfmI0jxRckRvC33P58c5ZVBg7s2ArBL_7LZ8i8y81DdHMa3wHV690zmxcXnXzeTctxOgSoA71-xCiyhTXNZdRfv/s1600-h/Formatting_Minutes_In_SSRS.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="186" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiE9URqBDn9oQyH3BnlJpl2JBSGzG8pyp30VhY9Vp81WZmyTAHWl4DPwfmI0jxRckRvC33P58c5ZVBg7s2ArBL_7LZ8i8y81DdHMa3wHV690zmxcXnXzeTctxOgSoA71-xCiyhTXNZdRfv/s400/Formatting_Minutes_In_SSRS.PNG" width="400" /&gt;&lt;/a&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: inherit;"&gt;&lt;span style="font-size: small;"&gt;Hope you will find this useful. If yes feel free to leave a comment below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;u&gt;&lt;b&gt;Note&lt;/b&gt;&lt;/u&gt;:&amp;nbsp; This article/demonstration is based on SSRS 2008. The options should be almost the same in SSRS 2005 as well.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://mytechnobook.blogspot.com/2010/01/formatting-minutes-as-hours-and-minutes.html</link><author>noreply@blogger.com (Dattatrey Sindol (Datta))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiE9URqBDn9oQyH3BnlJpl2JBSGzG8pyp30VhY9Vp81WZmyTAHWl4DPwfmI0jxRckRvC33P58c5ZVBg7s2ArBL_7LZ8i8y81DdHMa3wHV690zmxcXnXzeTctxOgSoA71-xCiyhTXNZdRfv/s72-c/Formatting_Minutes_In_SSRS.PNG" width="72"/><thr:total>0</thr:total></item></channel></rss>