<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2007575913516513302</id><updated>2025-10-17T13:38:32.683+05:30</updated><category term="SQL Basic Concepts"/><category term="DBA Scripts"/><category term="SQL Functions"/><category term="CodeProject"/><category term="SQL Advance Concepts"/><category term="Question of the Week"/><category term="Miscellaneous"/><category term="SQL Indexes"/><category term="SQLServerPediaSyndication"/><category term="SQL Database"/><category term="SQL Important Differences"/><category term="SQL Interview Questions"/><category term="SQL Tables"/><category term="SQL Normalization"/><category term="Sql Server"/><category term="Azure"/><category term="Azure SQL Database"/><category term="SQL Temporary table"/><category term="SQL Best Practices"/><category term="SQL CTE"/><category term="SQL Date time functions"/><category term="SQL Jobs"/><category term="SQL Stored Procedures"/><category term="Sql Triggers"/><category term="Android"/><category term="Happy Independence Day"/><category term="Happy New Year"/><category term="How to find the last access date of a database"/><category term="How to pass Microsoft Certification Exams"/><category term="Is Clustured index on column with duplicate values possible"/><category term="Question of the Month"/><category term="Recover Deleted Records"/><category term="Rollback Deleted Records"/><category term="SQL Apps"/><category term="SQL Cursor"/><category term="SQL Derived Tables"/><category term="SQL Duplicate  Values"/><category term="SQL Exception Handling"/><category term="SQL Joins"/><category term="SQL Log Shipping"/><category term="SQL Merge Command"/><category term="SQL Output Clause"/><category term="SQL Pivot  and Unpivot Table"/><category term="SQL Primary Keys and Foreign Keys"/><category term="SQL RANK() funtion"/><category term="SQL Recovery"/><category term="SQL Replication"/><category term="SQL Script for finding database restoration history"/><category term="SQL Script to find the database &amp; their files details on a SQL Server"/><category term="SQL Subquery and Correlated Subquery"/><category term="SQL User Defined Functions"/><category term="SQL View"/><category term="SQL query to find triggers"/><category term="SQLTea"/><category term="Smartphones"/><category term="SocialNetworking"/><category term="Whatsapp"/><category term="migration to Azure SQL"/><title type='text'>Technology with Vivek Johari</title><subtitle type='html'>Learn database in a simple and easy way.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>134</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-1465359732402928143</id><published>2019-01-09T13:06:00.005+05:30</published><updated>2019-01-09T13:06:55.622+05:30</updated><title type='text'>Please Vote for my article &quot;SQL Triggers - An Introduction&quot; on CodeProject.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white; font-size: 14px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.749019607843137); font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Fira Sans, Ubuntu, Oxygen, Oxygen Sans, Cantarell, Droid Sans, Apple Color Emoji, Segoe UI Emoji, Segoe UI Emoji, Segoe UI Symbol, Lucida Grande, Helvetica, Arial, sans-serif;&quot;&gt;&lt;a href=&quot;https://www.codeproject.com/script/Surveys/Vote.aspx?srvid=2181&quot; target=&quot;_blank&quot;&gt;Please Vote for my article &quot;SQL Triggers - An Introduction&quot; on CodeProject.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;One of my Code Project article on SQL Trigger has been selected as entry in this contest. &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;I have explain the concept of SQL triggers on it. &lt;/span&gt;&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;Please have a look on my article and if you like it, &lt;b&gt;Please VOTE for it.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;
Article:- 
SQL Trigger - An Introduction - Vivek Johari&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.75); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 14px; white-space: pre-wrap;&quot;&gt;&lt;a href=&quot;https://www.codeproject.com/script/Surveys/Vote.aspx?srvid=2181&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;CodeProject Link for Voting&lt;/b&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/1465359732402928143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2019/01/please-vote-for-my-article-sql-triggers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/1465359732402928143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/1465359732402928143'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2019/01/please-vote-for-my-article-sql-triggers.html' title='Please Vote for my article &quot;SQL Triggers - An Introduction&quot; on CodeProject.'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-5806021796269661857</id><published>2019-01-09T00:53:00.000+05:30</published><updated>2019-01-09T00:53:24.580+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure SQL Database"/><title type='text'>Point In Time Restore for Azure SQL Database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 class=&quot;entry-title&quot; style=&quot;background-color: white; border: 0px; clear: both; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 28px; font-weight: normal; line-height: 1.2; margin: 0px 0px 20px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/2019/01/point-in-time-restore-for-azure-sql-database.html&quot; rel=&quot;bookmark&quot; style=&quot;border: 0px; color: #111111; margin: 0px; outline: none; padding: 0px; text-decoration-line: none; vertical-align: baseline;&quot; title=&quot;Permalink to Point In Time Restore for Azure SQL Database&quot;&gt;Point In Time Restore for Azure SQL Database&lt;/a&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;This article try to explain&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Automatic backups services provided by Azure&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Backup retention periods&lt;/li&gt;
&lt;li&gt;How to take the point in time database restoration&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;This database restoration process help in protecting the database from corruption and more importantly from accidental deletion of data.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2019/01/point-in-time-restore-for-azure-sql-database.html&quot; target=&quot;_blank&quot;&gt;Read the full Article here&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://youtu.be/OlpBfAI9Pz4&quot; target=&quot;_blank&quot;&gt;Watch Video Tutorial&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='enclosure' type='text/html' href='http://www.techmixing.com/2019/01/point-in-time-restore-for-azure-sql-database.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/5806021796269661857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2019/01/point-in-time-restore-for-azure-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5806021796269661857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5806021796269661857'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2019/01/point-in-time-restore-for-azure-sql.html' title='Point In Time Restore for Azure SQL Database'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-167631905968638280</id><published>2018-12-24T23:24:00.003+05:30</published><updated>2018-12-24T23:24:40.318+05:30</updated><title type='text'>Merry Christmas</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Wish you all a &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;b&gt;Merry &lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;Christmas&lt;/b&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;and may this festival bring abundant joy and happiness in your life!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC3g8Pz7Y4I2JxtIhvLgyG-uhRSbxu39ix9i1EbEZaV5oKBA0fkbchzY2bysY7yGpyub6GRcm6WqBt7PaFUJn2v091mrn7VUnXqthiBVQZ_aXlgvm6_lkqa86ks0SWj8hPHsLXAL84e7lI/s1600/merry-christmas.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;459&quot; data-original-width=&quot;800&quot; height=&quot;228&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC3g8Pz7Y4I2JxtIhvLgyG-uhRSbxu39ix9i1EbEZaV5oKBA0fkbchzY2bysY7yGpyub6GRcm6WqBt7PaFUJn2v091mrn7VUnXqthiBVQZ_aXlgvm6_lkqa86ks0SWj8hPHsLXAL84e7lI/s400/merry-christmas.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
From&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&amp;nbsp;&lt;a href=&quot;http://www.techmixing.com/&quot; target=&quot;_blank&quot;&gt;&lt;b&gt;Technology with Vivek Johari&lt;/b&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/167631905968638280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/12/merry-christmas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/167631905968638280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/167631905968638280'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/12/merry-christmas.html' title='Merry Christmas'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC3g8Pz7Y4I2JxtIhvLgyG-uhRSbxu39ix9i1EbEZaV5oKBA0fkbchzY2bysY7yGpyub6GRcm6WqBt7PaFUJn2v091mrn7VUnXqthiBVQZ_aXlgvm6_lkqa86ks0SWj8hPHsLXAL84e7lI/s72-c/merry-christmas.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-4547176696233414392</id><published>2018-12-08T20:12:00.000+05:30</published><updated>2018-12-08T20:12:10.713+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Triggers"/><title type='text'>SQL Triggers – An Introduction</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.9); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 16px;&quot;&gt;This article will give you the detailed knowledge about the SQL Triggers which can be very helpful in your work. It will gives information about triggers &amp;amp; its various types, Magic tables, difference b/w trigger &amp;amp;&amp;nbsp; stored Procedure, finding, enabling &amp;amp; disabling triggers, advantages &amp;amp; disadvantages of triggers with the help of many examples.&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.9); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: rgba(0, 0, 0, 0.9); font-family: -apple-system, system-ui, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, &amp;quot;Fira Sans&amp;quot;, Ubuntu, Oxygen, &amp;quot;Oxygen Sans&amp;quot;, Cantarell, &amp;quot;Droid Sans&amp;quot;, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, Helvetica, Arial, sans-serif; font-size: 16px;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2018/12/sql-triggers-introduction.html&quot; target=&quot;_blank&quot;&gt;Read Full Article&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/4547176696233414392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/12/sql-triggers-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4547176696233414392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4547176696233414392'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/12/sql-triggers-introduction.html' title='SQL Triggers – An Introduction'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-618530809895761360</id><published>2018-11-25T19:21:00.000+05:30</published><updated>2018-11-25T19:21:02.512+05:30</updated><title type='text'>Migrating SQL Database To Azure SQL Instance using Microsoft Database Migration Assistant (DMA) Tool</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;In this article we learn migrating SQL Database To Azure SQL Instance using Microsoft Database Migration Assistant (DMA) Tool. In this article, I have explained this as a step by step process&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: large;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://www.techmixing.com/2018/11/migrating-sql-database-to-azure-sql-instance-using-microsoft-database-migration-assistant-dma-tool.html&quot;&gt;Read Full Article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; clear: both; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; line-height: 1.8; margin: 24px 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff6600; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Read more&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;a href=&quot;http://www.techmixing.com/sql-tutorial&quot; style=&quot;border: 0px; color: #0b91ea; font-size: 14px; margin: 0px; outline: none; padding: 0px; text-decoration-line: none; vertical-align: baseline;&quot;&gt;SQL Tutorial&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;background-color: white; border: 0px; clear: both; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; line-height: 1.8; margin: 24px 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff6600; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;border: 0px; color: #444444; font-size: 14px; font-weight: 400; line-height: 1.7; margin-bottom: 20px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/azure-tutorial&quot; style=&quot;border: 0px; color: #0b91ea; margin: 0px; outline: none; padding: 0px; text-decoration-line: none; vertical-align: baseline;&quot;&gt;Azure Tutorial&lt;/a&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/h4&gt;
&lt;div style=&quot;background-color: white; border: 0px; clear: both; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; line-height: 1.8; margin: 24px 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/11/how-to-migrate-sql-database-to-azure-sql-database-using-ssms-export-import.html&quot; style=&quot;border: 0px; color: #0b91ea; margin: 0px; outline: none; padding: 0px; text-decoration-line: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;How to migrate SQL Database to Azure SQL Database using SSMS Export/Import&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #444444; font-family: Ubuntu, Helvetica, Arial, sans-serif; line-height: 1.7; margin-bottom: 20px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/11/how-to-migrate-sql-database-to-azure-sql-database-using-ssms-deploy.html&quot; style=&quot;border: 0px; color: #0b91ea; margin: 0px; outline: none; padding: 0px; text-decoration-line: none; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Migrating SQL Database to Azure SQL Database using SSMS Deploy&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/618530809895761360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/11/migrating-sql-database-to-azure-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/618530809895761360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/618530809895761360'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/11/migrating-sql-database-to-azure-sql.html' title='Migrating SQL Database To Azure SQL Instance using Microsoft Database Migration Assistant (DMA) Tool'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-2508611713865266501</id><published>2018-11-19T18:39:00.000+05:30</published><updated>2018-11-19T18:44:50.774+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure SQL Database"/><category scheme="http://www.blogger.com/atom/ns#" term="migration to Azure SQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/How-to-migrate-SQL-Database-to-Azure-SQL-Database-using-SSMS-ExportImport.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;How to migrate SQL Database to Azure SQL Database using SSMS Export/Import&quot; class=&quot;wp-image-1134 size-medium&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/How-to-migrate-SQL-Database-to-Azure-SQL-Database-using-SSMS-ExportImport-300x195.png&quot; height=&quot;195&quot; title=&quot;How to migrate SQL Database to Azure SQL Database using SSMS Export/Import&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
How to migrate SQL Database to Azure SQL Database using SSMS Export/Import&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
Migrating SQL Database to Azure SQL Database using SSMS Export/Import&lt;/h2&gt;
&lt;h3&gt;
Contents&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Creating the .bacpac file using SSMS Export&lt;/li&gt;
&lt;li&gt;Importing the .bacpac file using SSMS Import&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Introduction&lt;/h3&gt;
There are many ways of migrating the On premise SQL Database to Azure SQL Database. In the previous article on migrating SQL Database to Azure SQL Database, we discuss the&lt;strong&gt;&lt;a href=&quot;http://www.techmixing.com/2018/11/how-to-migrate-sql-database-to-azure-sql-database-using-ssms-deploy.html&quot;&gt; SSMS deploy method&lt;/a&gt;&lt;/strong&gt; as a step by step process. This article will tell&amp;nbsp;how to migrate SQL Database to Azure SQL Database using SSMS Export/Import data as a step by step process. It is a multi steps process where in first step we need to export the data into a BACPAC (.bacpac ) and then in next step, import that BACPAC file. It means even if the import data step is failed, we doesn&#39;t need to repeat the data export process again. As we have have the exported BACPAC file, we just need to restart the Import process. This process require longer downtime. So this process is suitable for larger databases if the downtime duration is acceptable.&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Migrating SQL Database to Azure SQL Database using SSMS Export data&lt;/h3&gt;
&lt;h3&gt;
Creating the .bacpac file using SSMS Export&lt;/h3&gt;
As a first step, we need to create the .bacpac file of the On premise SQL database which we want to migrate to the Azure SQL Server. So connect to the On premise database server and select the SQL database to migrate. Right click on it and select the option &lt;strong&gt;Export Data-tier Application..&lt;/strong&gt; (as shown in the below screenshot)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_1.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Select the database for migrating to Azure&quot; class=&quot;wp-image-1085 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_1-1024x576.png&quot; height=&quot;374&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Select the database for migrating to Azure&lt;br /&gt;
&lt;br /&gt;
Once the option&amp;nbsp;&lt;strong&gt;Export Data-tier Application.. &lt;/strong&gt;clicked, it will open the &lt;b&gt;Export Data-Tier Application&amp;nbsp;&lt;/b&gt;page as shown in the below screenshot.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_2.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Introduction Screen for Data export&quot; class=&quot;wp-image-1086 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_2-1024x672.png&quot; height=&quot;436&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Introduction Screen for Data export&lt;br /&gt;
&lt;br /&gt;
Click on &lt;strong&gt;Next&lt;/strong&gt; button to reach the Export Setting screen. In this screen, we need to select the location for storing the .bacpac file.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_3.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Select the .bacpac file location&quot; class=&quot;wp-image-1087 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_3-1024x680.png&quot; height=&quot;442&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Select the export (.bacpac) file location&lt;br /&gt;
&lt;br /&gt;
Click on the &lt;strong&gt;Next&lt;/strong&gt; button to reach the Summary Page. In this screen, we need to recheck the setting which we have specified.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_4.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Verify the specified settings&quot; class=&quot;wp-image-1088 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_4-1024x678.png&quot; height=&quot;440&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Verify the specified settings&lt;br /&gt;
&lt;br /&gt;
After verifying the specified settings, click on the &lt;strong&gt;Finish&lt;/strong&gt; button. It will start the process of .bacpac file creation as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_5.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Processing the creation of .bacpac file&quot; class=&quot;wp-image-1089 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_5-1024x675.png&quot; height=&quot;438&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Processing the creation of .bacpac file&lt;br /&gt;
&lt;br /&gt;
Once this operation got completed, below screen comes. Click on the &lt;strong&gt;Close&lt;/strong&gt; button. This will complete the database export part of this migration process.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_6.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Operation Completion Screen&quot; class=&quot;wp-image-1090 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_6-1024x680.png&quot; height=&quot;442&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Operation Completion Screen&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Importing the .bacpac file using SSMS Import&lt;/h3&gt;
After creating the .bacpac file by exporting the data, we need to import it into the Azure SQL Database. For this, first connect with the Azure SQL Server through SSMS. Then right-click on the Databases node and choose Import Data-Tier Application..&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_7.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Choose Import Data-Tier Application&quot; class=&quot;wp-image-1091 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_7-1024x576.png&quot; height=&quot;374&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Choose Import Data-Tier Application.&lt;br /&gt;
&lt;br /&gt;
It will open the below &lt;strong&gt;Import Data-Tier Application&lt;/strong&gt;.. page as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_8.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Import Data-Tier Application..&quot; class=&quot;wp-image-1092 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_8-1024x679.png&quot; height=&quot;441&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Import Data-Tier Application..&lt;br /&gt;
&lt;br /&gt;
Click &lt;strong&gt;Next&lt;/strong&gt; button. It will open the Import Settings page. In this page we need to specify the .bacpac file location for import.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_9.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Specify the BACPAC file for import&quot; class=&quot;wp-image-1093 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_9-1024x683.png&quot; height=&quot;444&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Specify the BACPAC file for import&lt;br /&gt;
&lt;br /&gt;
Click &lt;strong&gt;Next&lt;/strong&gt; to reach database setting page. Here we need to specify the Azure SQL Server Name, New Azure SQL Database name &amp;amp; the service tier based on the database size and other requirement as shown in the below screenshot&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_10.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Database setting page&quot; class=&quot;wp-image-1094 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_10-1024x679.png&quot; height=&quot;441&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Database setting page&lt;br /&gt;
&lt;br /&gt;
We can change the default Microsoft Azure SQL Database settings as per your requirement. For example, I have changed the Edition of Microsoft Azure SQL Database, Maximum database size (GB) and Service Objective for my database as shown in the below screenshot.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_11.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Change Azure SQL Database default settings&quot; class=&quot;wp-image-1095 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_11-1024x683.png&quot; height=&quot;444&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Change Azure SQL Database default settings&lt;br /&gt;
&lt;br /&gt;
Once all database settings&amp;nbsp;defined, click on the &lt;strong&gt;Next&lt;/strong&gt; button. It will bring up the &lt;strong&gt;Summary&lt;/strong&gt; page as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_12.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Summary Page for verify settings&quot; class=&quot;wp-image-1096 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_12-1024x682.png&quot; height=&quot;443&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Summary Page for verify settings&lt;br /&gt;
&lt;br /&gt;
Once settings verified, click on the Finish Button. It will start the Import process as shown in below screenshot.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_13.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Importing Database...&quot; class=&quot;wp-image-1097 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_13-1024x678.png&quot; height=&quot;440&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Importing Database...&lt;br /&gt;
&lt;br /&gt;
Once the Importing database process completed successfully, it will bring up the Result page. Click on the &lt;strong&gt;Close&lt;/strong&gt; button.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_14.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Result Page - Importing Database process successfully completed &quot; class=&quot;wp-image-1098 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_14-1024x676.png&quot; height=&quot;439&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Result Page - Importing Database process successfully completed&lt;br /&gt;
&lt;br /&gt;
Database is successfully imported to the Azure SQL Database. We&amp;nbsp;can it&amp;nbsp;verify by connecting the Azure SQL Database using the SQL Server Management Studio and then expanding the Database node. Database will be visible and it is available for SQL queries as shown in the below screenshot.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_15.png&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Executing SQL Query against the imported database&quot; class=&quot;wp-image-1099 size-large&quot; src=&quot;http://www.techmixing.com/wp-content/uploads/2018/11/export_15-1024x531.png&quot; height=&quot;345&quot; width=&quot;665&quot; /&gt;&lt;/a&gt; Executing SQL Query against the imported database[/caption]&lt;br /&gt;
&lt;h2&gt;
Summary&lt;/h2&gt;
This article is the part of the series Migrating SQL databases to Azure SQL Database. In the last article in this series, we discussed&amp;nbsp; &lt;a href=&quot;http://www.techmixing.com/2018/11/how-to-migrate-sql-database-to-azure-sql-database-using-ssms-deploy.html&quot;&gt;SSMS deploy method for migrating the SQL Database to Azure&lt;/a&gt;. In this article we discussed&amp;nbsp;how to migrate SQL Database to Azure SQL Database using SSMS Export/Import data as a step by step process. Unlike SSMS deploy method, which is a single step process and suitable for smaller database, it is a multi step process and suitable for large database but with longer downtime required. In the next article, we will going to discuss the migration of SQL database to Azure SQL Database using the&amp;nbsp;Microsoft database migration assistant (DMA) tool.&lt;br /&gt;
Please don’t forget to gives your valuable comments for the article or you can send me the direct queries to my Email id&amp;nbsp;&lt;strong&gt;askvivekjohari@gmail.com. &lt;/strong&gt;If you want you can also join our Facebook community&lt;a href=&quot;https://www.facebook.com/technologywithvivekjohari&quot;&gt;&lt;strong&gt; here&lt;/strong&gt;&lt;/a&gt;&amp;nbsp;or follow me on &lt;strong&gt;&lt;a href=&quot;https://twitter.com/VivekJohari&quot;&gt;Twitter&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;h3&gt;
Read More&lt;/h3&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/11/how-to-migrate-sql-database-to-azure-sql-database-using-ssms-deploy.html&quot;&gt;Migrating SQL Database to Azure SQL Database using SSMS Deploy&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/03/understanding-azure-sql-database.html&quot;&gt;Understanding Azure SQL Database- Introduction&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;entry-title&quot;&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/04/azureservicetiers.html&quot;&gt;Azure Pricing Models and Service Tiers&lt;/a&gt;&lt;/div&gt;
&lt;a href=&quot;https://wp.me/p9P1Ko-dy&quot;&gt;Azure – Creating an Azure SQL Database&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/2018/10/connect-to-azure-sql-database.html&quot;&gt;How to connect with Azure SQL Database&lt;/a&gt;&lt;br /&gt;
&lt;h3&gt;
Read more from Tutorials&lt;/h3&gt;
&lt;a href=&quot;http://www.techmixing.com/sql-tutorial&quot;&gt;SQL Tutorial&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.techmixing.com/azure-tutorial&quot;&gt;Azure Tutorial&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/2508611713865266501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/11/how-to-migrate-sql-database-to-azure.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/2508611713865266501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/2508611713865266501'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/11/how-to-migrate-sql-database-to-azure.html' title=''/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-4708043708141619800</id><published>2018-04-10T16:54:00.000+05:30</published><updated>2018-04-10T16:54:02.631+05:30</updated><title type='text'>Blog trasfering to new hosting server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi Friends,&lt;br /&gt;
&lt;br /&gt;
This blog is now transferring to different hosting server. So you may got some issue in accessing it. Sorry for the inconvenience&amp;nbsp; caused&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/4708043708141619800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/04/blog-trasfering-to-new-hosting-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4708043708141619800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4708043708141619800'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/04/blog-trasfering-to-new-hosting-server.html' title='Blog trasfering to new hosting server'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-1008079064755002986</id><published>2018-03-30T19:31:00.001+05:30</published><updated>2018-03-30T19:31:45.761+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Script to find the database &amp; their files details on a SQL Server"/><title type='text'>SQL Script to find the database &amp; their files details on a SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sometimes we need a SQL Script which can gives the below information about the databases created on a SQL Server for house keeping purpose: -&lt;br /&gt;
&lt;br /&gt;
1) Database Name&lt;br /&gt;
2) Database ID&lt;br /&gt;
3) Database Files name with their physical location&lt;br /&gt;
4) Database Creation Time&lt;br /&gt;
5) Users access type for Database&lt;br /&gt;
6) Database recovery model&lt;br /&gt;
7) Database State (ON/OFF)&lt;br /&gt;
8) Database Collation&lt;br /&gt;
9) File size on the Disk&lt;br /&gt;
&lt;br /&gt;
Following SQL Query will help you in finding the above mentioned information for all databases on a SQL Server&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;sd.[Name] AS [database Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.database_id [Database Id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,mf.name as [File Logical Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,case&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;when type_desc = &#39;LOG&#39; then &#39;Log File&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;when type_desc = &#39;ROWS&#39; then &#39;Data File&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;Else type_desc&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;end as [File type]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,mf.physical_name [Physical Location]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.create_date [Database Creation date]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.collation_name [collation name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.user_access_desc [User Access Type]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.recovery_model_desc [Database Recovery Model]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,sd.state_desc [Database State]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,size_on_disk_bytes [File Size in bytes]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,size_on_disk_bytes/ 1024 as [File Size in KB]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;,size_on_disk_bytes/ 1024 / 1024 as [File Size in MB]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS fs&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;inner join sys.databases sd on fs.database_id=sd.database_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;JOIN sys.master_files AS mf ON mf.database_id = fs.database_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;AND mf.file_id = fs.file_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;ORDER BY sd.database_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
I hope that above query will be helpful to you. Don&#39;t forget to give your valuable comments on this article. Also you can send me your valuable feedback on my email id askvivekjohari@gmail.com&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/1008079064755002986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-to-find-database-their-files.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/1008079064755002986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/1008079064755002986'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-to-find-database-their-files.html' title='SQL Script to find the database &amp; their files details on a SQL Server'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-588962855791563247</id><published>2018-03-30T15:38:00.001+05:30</published><updated>2018-03-30T15:52:29.915+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Script for finding database restoration history"/><title type='text'>SQL Script: - How to find the database restoring history of SQL Server databases</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Sometime we need to find out the history of database restoration to get the answers of following questions: -&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;1) Do we need to restore the database again as there can be a possibility that it is restored recently?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;2) Which backup file (with location information) is used for database restoration?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;3) Name of the source database whose backup file is used database restoration?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;4) When database backup file is created ?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;5) Which user perform the database restoration activity?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Below query can be used for finding the database restoration history&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;SELECT [r].[destination_database_name] as [Database Name],&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[r].[restore_date] [Restore Date],&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[r].user_name as [User],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;(cast([b].software_major_version as varchar(10))+&#39;.&#39; +&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;cast([b].software_minor_version as varchar(10)) +&#39;.&#39;+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;cast([b].software_build_version as varchar(10))) as [Server version],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[b].compressed_backup_size as [Backup file Size],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[b].[backup_start_date] [Backup Start Time],&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[b].[backup_finish_date][Backup End Time],&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[b].[database_name] as [Source Database Name],&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;[bkpmf].[physical_device_name] as [Backup File Used For Database Restore]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;FROM msdb..restorehistory r&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;INNER JOIN msdb..backupset b&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;ON [r].[backup_set_id] = [b].[backup_set_id]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;INNER JOIN msdb..backupmediafamily bkpmf&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;ON [b].[media_set_id] = [bkpmf].[media_set_id]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;ORDER BY [r].[restore_date] DESC&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;For example, suppose we created a database name as &quot;Sampledatabase&quot; which is never restored. Then if we execute the above query we got no restoration history of this database:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo8e9U2OloZdhafp29hSYOKSlajK4ntzosPybRFHxxylNcEl_om6cIDdgkr4KC99gF9ZCFABEYydhKEjnikn8-6QWJPGwunZqMWg1B-kLKCZupXhIB_ykpzpVnwPHug4_Lq1ikRO-udMYD/s1600/DB_recovery_1.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;437&quot; data-original-width=&quot;1284&quot; height=&quot;135&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo8e9U2OloZdhafp29hSYOKSlajK4ntzosPybRFHxxylNcEl_om6cIDdgkr4KC99gF9ZCFABEYydhKEjnikn8-6QWJPGwunZqMWg1B-kLKCZupXhIB_ykpzpVnwPHug4_Lq1ikRO-udMYD/s400/DB_recovery_1.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now we take backup of this database&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgptny3n-effKB0vfaNMkLMSOkh1jFuV09Z0i1jisNVoPGg3WW7jAtxH0zjeKmIVA60bXUXLrInuGc-VGQ4F3kSnTlhtAZwRa6oZX_DTAB03An3-cohjjUl2jybJClZaHh5wvaxUj1Uu50V/s1600/DB_recovery_2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;403&quot; data-original-width=&quot;846&quot; height=&quot;190&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgptny3n-effKB0vfaNMkLMSOkh1jFuV09Z0i1jisNVoPGg3WW7jAtxH0zjeKmIVA60bXUXLrInuGc-VGQ4F3kSnTlhtAZwRa6oZX_DTAB03An3-cohjjUl2jybJClZaHh5wvaxUj1Uu50V/s400/DB_recovery_2.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;and restore the &quot;Sampledatabase&quot; with the backup taken in the above step.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm5MJnHXN3ALfGksWEkFOBig-26ZXDPTTqOaoXeDtF5FyEhs6YYZzSFBxbKYpTosVgbJ6h2eXqhb5QYpp8vX1cd2c1BKvlDle_STLXQGwPV42zMpisSVOQAwtkSZk3SfBwqrY1yePgyiKF/s1600/DB_recovery_3.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;524&quot; data-original-width=&quot;1055&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm5MJnHXN3ALfGksWEkFOBig-26ZXDPTTqOaoXeDtF5FyEhs6YYZzSFBxbKYpTosVgbJ6h2eXqhb5QYpp8vX1cd2c1BKvlDle_STLXQGwPV42zMpisSVOQAwtkSZk3SfBwqrY1yePgyiKF/s400/DB_recovery_3.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;If we again execute the SQL Script to get database restoration history, we got the following result&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjQ0KuQr9VpvykqcMudnJ9X7OnmJSTttw6Tzv6c0b8nAaizs3u0LqyRDBvd0JjdkrZO4An6a0q-VO_DZSFBev1GHoZmwgitXYtRjugA7p61LGraMKHfx8EoTAWTS0RfihU-ih2G9hbcTsk/s1600/DB_recovery_4.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;460&quot; data-original-width=&quot;1193&quot; height=&quot;152&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjQ0KuQr9VpvykqcMudnJ9X7OnmJSTttw6Tzv6c0b8nAaizs3u0LqyRDBvd0JjdkrZO4An6a0q-VO_DZSFBev1GHoZmwgitXYtRjugA7p61LGraMKHfx8EoTAWTS0RfihU-ih2G9hbcTsk/s400/DB_recovery_4.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Now if we take another backup with the different name as &quot;SampleDatabase_1.bak&quot; on the same location and tried to restore the database again, then one more entry for the Sampledatbase will come on the execution of the SQL query for getting Database restoration history as shown in below images&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_K7SFpMtOCynGUowli5-QLgt9qFkdaqMN5y9TY0crWHyogoGxCaSxeMZx9VJHQlB6w82QhhNpe05qFRCk6y26q0jHjSww2aL1RDxtAOwW7stusezn3jbmEWVyNzZxuAshderlqBY0BVLu/s1600/DB_recovery_6.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;533&quot; data-original-width=&quot;1064&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_K7SFpMtOCynGUowli5-QLgt9qFkdaqMN5y9TY0crWHyogoGxCaSxeMZx9VJHQlB6w82QhhNpe05qFRCk6y26q0jHjSww2aL1RDxtAOwW7stusezn3jbmEWVyNzZxuAshderlqBY0BVLu/s400/DB_recovery_6.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc97wPQH9LDBcIEa4SE907gupn-9-1gpv4Yr5jMcc6Ie_JfPMwulCHOlIqOdss3oQYRF9G3mZfZqqnrWeC6HRbnSofFWxH-LKhc0L4dwqCscROMI5KrP7Nkhvlto5260Tye9daGldWE6uJ/s1600/DB_recovery_7.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;478&quot; data-original-width=&quot;1190&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc97wPQH9LDBcIEa4SE907gupn-9-1gpv4Yr5jMcc6Ie_JfPMwulCHOlIqOdss3oQYRF9G3mZfZqqnrWeC6HRbnSofFWxH-LKhc0L4dwqCscROMI5KrP7Nkhvlto5260Tye9daGldWE6uJ/s400/DB_recovery_7.PNG&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;If we see the outcome of the query, we also got the version of the SQL server on which database backup file is created &amp;amp; the size of the backup file. Sometime these additional information can become handy.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
I hope database guy will get help from this query. Please send me your valuable feedback on askvivekjohari@gmail.com. Thanks for visiting my blog.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/588962855791563247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-how-to-find-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/588962855791563247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/588962855791563247'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-how-to-find-database.html' title='SQL Script: - How to find the database restoring history of SQL Server databases'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjo8e9U2OloZdhafp29hSYOKSlajK4ntzosPybRFHxxylNcEl_om6cIDdgkr4KC99gF9ZCFABEYydhKEjnikn8-6QWJPGwunZqMWg1B-kLKCZupXhIB_ykpzpVnwPHug4_Lq1ikRO-udMYD/s72-c/DB_recovery_1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-3135573028283413787</id><published>2018-03-29T17:28:00.001+05:30</published><updated>2018-03-29T17:28:51.091+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="How to find the last access date of a database"/><title type='text'>SQL Script: - How to find the last access date of a database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Sometime we create databases on Test/ Development database servers for temporary uses for short duration and&amp;nbsp; forgot to delete them after the work got completed. As a part of house keeping activity, we need to find out when a database is last accessed in order to find out the databases which are not used since long time and can be a deleted.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Below mentioned SQL query will going to help you in finding out the last access date of all the databases of a SQL server&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;SELECT name as [Database Name], [Last Access Date] =(select MAX(temp.lastaccess)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;from ( select lastaccess =&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;max(last_user_seek)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;where max(last_user_seek)is not null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;select lastaccess = max(last_user_scan)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;where max(last_user_scan)is not null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;select lastaccess = max(last_user_lookup)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;where max(last_user_lookup) is not null&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;select lastaccess =max(last_user_update)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;where max(last_user_update) is not null) temp)&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;FROM master.dbo.sysdatabases sysdb&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;left outer join sys.dm_db_index_usage_stats Idxus&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;on sysdb.dbid= Idxus.database_id&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;group by sysdb.name&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: blue; font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/3135573028283413787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-how-to-find-last-access-date.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/3135573028283413787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/3135573028283413787'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/sql-script-how-to-find-last-access-date.html' title='SQL Script: - How to find the last access date of a database'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-4198229533901349244</id><published>2018-03-19T00:15:00.002+05:30</published><updated>2018-03-19T00:15:44.199+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Azure"/><category scheme="http://www.blogger.com/atom/ns#" term="Azure SQL Database"/><title type='text'>Understanding Azure SQL Database- Introduction </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
Introduction:-&amp;nbsp;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In this first article of the series Understanding Azure SQL Database in which I am going to publish in the coming weeks to understand Azure SQL Database concepts. After this series, you will have the good understanding of the following Azure SQL concepts&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;What is Azure and Azure SQL Database&lt;/li&gt;
&lt;li&gt;Pricing Model of Azure SQL&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Creating SQL Server &amp;amp; Database on Azure and how to connect them&lt;/li&gt;
&lt;li&gt;Understanding of different Azure Service Tier&lt;/li&gt;
&lt;li&gt;Difference between Azure SQL Database &amp;amp; SQL Server&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Security features in Azure SQL Database&lt;/li&gt;
&lt;li&gt;Database Transaction Units (DTU) &amp;amp; how to calculate it.&lt;/li&gt;
&lt;li&gt;Elastic Pool in Azure SQL Database&lt;/li&gt;
&lt;li&gt;Database Backup &amp;amp; Restoration in Azure SQL Database&lt;/li&gt;
&lt;li&gt;High Availability &amp;amp; Disaster Recovery feature in Azure SQL Database&lt;/li&gt;
&lt;li&gt;Database Migration from SQL Server to Azure SQL database&lt;/li&gt;
&lt;li&gt;Database Migration from Azure SQL Database to SQL Server&lt;/li&gt;
&lt;li&gt;Azure Metric Alerts and how to create them&lt;/li&gt;
&lt;li&gt;Performance Tuning in Azure SQL Database&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
When we think of Azure SQL Database, first question comes in our mind is what is Azure? Microsoft Azure is a cloud computing platform created by Microsoft to build, test, deploy and host the applications using the global network of Microsoft managed data centers.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Next question comes, what is Azure SQL Database? Azure SQL database can be defined as the Database as a Service offered on Microsoft Azure. By Database as a Service means that Microsoft as the service provider will going to manage the database software, taken care of&amp;nbsp; Database backup, recovery, High Availability, Operating System. We as users only need to taken care of database and the queries running inside the database. Also we need to pay as per our current database uses and nothing to pay anything upfront. Also we can scale up or scale down or create or destroy the environment as per our requirement without any interference from the provider Microsoft.&lt;br /&gt;
&lt;br /&gt;
Azure provides three Service tiers for setting up the SQL Database. These 3 Service Tiers are:-&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1) Basic Service Tier&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;2) Standard Service Tier&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;3) Premium Service Tier&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Within Standard &amp;amp; Premium Service tiers we have different level. For example in Standard Service tier we have 4 levels S0 , S1, S2 &amp;amp; S3. In Premium Service tier, we have 6 levels P1, P2, P4, P6, P11 &amp;amp; P15.&lt;br /&gt;
&lt;br /&gt;
Azure SQL Database Backup Retention time period, Performance, Database Size are depend on which Service Tier we choose at the time of database creation. We can change the service tier or service tier level any time as per application requirement. We will going to know more about Service tiers in the coming articles in this series.&lt;br /&gt;
&lt;br /&gt;
Pricing of&amp;nbsp; Azure SQL database is calculated on the hourly bases and it depends upon which Service tier we have used. The hourly rate is determine on the basis of highest Service tier we used in that hour.&lt;br /&gt;
&lt;br /&gt;
In case of&amp;nbsp; SQL Server hosted in a VM, users are responsible for maintaining the operating system, taking regular database backups, database disaster recovery planning, maintaining the SQL Server, SQL performance &amp;amp; Security. But in case of case of Azure SQL database, we just need to choose the correct Service Tier as Azure itself responsible of taking care of operating system, Backups, High Availability &amp;amp; Security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are many features of Azure SQL database, which we are going to cover in the upcoming next articles of this series. Till then keep learning and keep visiting this site. Don&#39;t forget to send your valuable feedback as comment or you can send to my mail id &lt;u&gt;&lt;b&gt;askvivekjohari@gmail.com&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/4198229533901349244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/understanding-azure-sql-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4198229533901349244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4198229533901349244'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2018/03/understanding-azure-sql-database.html' title='Understanding Azure SQL Database- Introduction '/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-8677298011306980733</id><published>2017-08-08T17:59:00.000+05:30</published><updated>2017-08-09T12:49:23.493+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Recover Deleted Records"/><category scheme="http://www.blogger.com/atom/ns#" term="Rollback Deleted Records"/><title type='text'>Learn How to Recover Deleted Records from SQL Server 2014</title><content type='html'>
&lt;p&gt;&lt;b&gt;Problem&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Sometimes users may have numerous of databases in their SQL Server. However, while managing their database sometimes by mistake their records are deleted due to which they face a lot of issues. To maintain the workflow they need to recover deleted records from SQL Server 2014. This could be possible only with successful &lt;a href=&quot;https://www.systoolsgroup.com/sql-log-analyzer.html&quot;&gt;&lt;b&gt;SQL LOG Recovery&lt;/b&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;How to Get Back Deleted Records in SQL Server: Solution&lt;/h2&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Mainly Transaction log is responsible for all database-logging activities. Similarly, in this discussion, we will utilize the usage of similar undocumented function &quot;fn_dblog&quot; to get any unauthorized deletion of data as well as to retrieve deleted data in SQL server.&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;If you are aware that when your data is removed then, you can easily solve your problem on how to recover deleted data in SQL server database. However, if you do not know the data as well as the time when the data is erased then, it is important to understand first who has deleted the data. In this segment, we will first find the particular LSN under which deleted statement is run after that we will rollback deleted records in SQL until that LSN.&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Each record in MS SQL Server transaction log is distinctively recognized by LSN (Log Sequence Number). LSN of log record at which particular event happened can be beneficial for making precise restore sequences and to retrieve deleted data. LSNs are utilized internally at the time of RESTORE sequence to path the point in time at which the data has been reinstated. When data backup is restored, data is reinstated to LSN corresponding to point in time at which backup was taken. Differential, as well as log backups, advance restored the database to later time that corresponds to higher LSN.&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;&lt;strong&gt;Important&lt;/strong&gt;: Do not do any modifications in production without testing it properly in lower-life cycle environments&lt;/p&gt;
&lt;h2&gt;Recover Deleted Records from SQL Server with LSN&lt;/h2&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Follow these steps to recover deleted records in SQL Server with successful SQL Log Recovery:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Step 1&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Before moving further, we will make the database as well as the table on which one will run DELETE statement. Then, we will get the data deletion and then rollback deleted records in SQL. Implement the T-SQL code given below to generate database and table and retrieve deleted data.&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxA_OLacZ-DmmzXEEGAqSgBJa6OGuq1mrvCk5Mx8mF64FRnl_DpGN9Ea7kHqv2kgpGfblJscyp03GR2PQOIqZP1pkFmJwwrSe0h0-oftbA9hx6JRitmdvgY4SGL1cjIqW6FZy6MUpthpd1/s1600/1.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxA_OLacZ-DmmzXEEGAqSgBJa6OGuq1mrvCk5Mx8mF64FRnl_DpGN9Ea7kHqv2kgpGfblJscyp03GR2PQOIqZP1pkFmJwwrSe0h0-oftbA9hx6JRitmdvgY4SGL1cjIqW6FZy6MUpthpd1/s1600/1.PNG&quot; data-original-width=&quot;500&quot; data-original-height=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;/br&gt;
&lt;p&gt;&lt;b&gt;Step 2&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;We have made a database with table &#39;Location&#39; of three columns. Now, we will put few rows in table.&lt;/p&gt;

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OV6cVPk0c1ZTVBcn7N8G3F-Fi-PQ9im1i0JVnGP1GD3_BrbRk5TmHRekrKao4EAxs70Lb856rskl02WhHHWg73IaDG422nmjYv7-dDOgVRn0imAF_0Xzngu2Tg5I_JvzcH4riKE5eL4I/s1600/2.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OV6cVPk0c1ZTVBcn7N8G3F-Fi-PQ9im1i0JVnGP1GD3_BrbRk5TmHRekrKao4EAxs70Lb856rskl02WhHHWg73IaDG422nmjYv7-dDOgVRn0imAF_0Xzngu2Tg5I_JvzcH4riKE5eL4I/s1600/2.PNG&quot; data-original-width=&quot;600&quot; data-original-height=&quot;90&quot; /&gt;&lt;/a&gt;
&lt;/br&gt;
&lt;p&gt;&lt;b&gt;Step 3&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;We will go further to erase some rows and recover deleted records from SQL Server table by using LSNs from the SQL Server Transaction Log.&lt;/p&gt;

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnGj75aQwkyZMIq6SsNWg065gDeAJ0crIh1wsc2tjGvQPGzceSkMNNDmd-X-qh7fw3JmV0GC3EPPPRi7yUQ1SOCJOahZhB8B5yS6DIHoBxyeMXb-iVWpqht_P4vz_SLxESx5WBJxU2Qzxb/s1600/3.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnGj75aQwkyZMIq6SsNWg065gDeAJ0crIh1wsc2tjGvQPGzceSkMNNDmd-X-qh7fw3JmV0GC3EPPPRi7yUQ1SOCJOahZhB8B5yS6DIHoBxyeMXb-iVWpqht_P4vz_SLxESx5WBJxU2Qzxb/s1600/3.PNG&quot; data-original-width=&quot;500&quot; data-original-height=&quot;250&quot; /&gt;&lt;/a&gt;

&lt;p&gt;&lt;b&gt;Step 4&lt;/b&gt;&lt;/p&gt; 
&lt;p style=&quot;text-align:justify&quot;&gt;Now, find the SQL Server Transaction Log and retrieve deleted records in SQL. Run the mentioned code below to get data information about all removed transactions with SQL Log recovery.&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb-78fp0rqqs0pDvbKxBFfyQzo8XFo4fTJaicQrG7T2JR1SGUiK7P-yI7xYetl3-wSUU-8vVa1nNBhmFzg1VZv2d2DrJ8TI_YdqmZLYJun3DhRA4h8KN2gIei3EiIETnNQT-3hyLnwGhVS/s1600/4.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb-78fp0rqqs0pDvbKxBFfyQzo8XFo4fTJaicQrG7T2JR1SGUiK7P-yI7xYetl3-wSUU-8vVa1nNBhmFzg1VZv2d2DrJ8TI_YdqmZLYJun3DhRA4h8KN2gIei3EiIETnNQT-3hyLnwGhVS/s1600/4.PNG&quot; data-original-width=&quot;500&quot; data-original-height=&quot;400&quot; /&gt;&lt;/a&gt;

&lt;p style=&quot;text-align:justify&quot;&gt;You can see the transaction IDs under which DELETE statement was executed. As we know that data is removed from Location table, we will focus on only those transaction IDs under which data is erased from location table to retrieve deleted data. We can get table name from &quot;AllocUnitName&quot; column. It states DELETE statement has been executed on HEAP table &#39;dbo.Location&#39; under transaction ID 0000:0000055e. There is only one transaction ID under which we can view deleted records SQL Server, which means this action has been implemented in a single batch. Now, capture transaction ID from next command.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Step 5&lt;/b&gt;&lt;/p&gt; 
&lt;p style=&quot;text-align:justify&quot;&gt;We initiate that transaction ID from above script that we will utilize in below statement to find the LSN of LOP_BEGIN_XACT operation and recover deleted records from SQL Server. It means that we want an exact LSN when DELETE statement started its transaction to retrieve deleted data.&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjke3s-xMT96aWwhrtdCMcBZ9sDsxmbgcME4ovpmUeK7xhwXtRRfZKUMtzaJQ3esKh1OfL7ZW8sdc27oJaEGZtuTwLRxHBBTqA5nBH3HvO-EHUPadTNaI2S-WvgMKfZ00fUEcJViyVPiKtJ/s1600/5.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjke3s-xMT96aWwhrtdCMcBZ9sDsxmbgcME4ovpmUeK7xhwXtRRfZKUMtzaJQ3esKh1OfL7ZW8sdc27oJaEGZtuTwLRxHBBTqA5nBH3HvO-EHUPadTNaI2S-WvgMKfZ00fUEcJViyVPiKtJ/s1600/5.PNG&quot; data-original-width=&quot;500&quot; data-original-height=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;p&gt;&lt;b&gt;Step 6&lt;/b&gt;&lt;/p&gt; 
&lt;p style=&quot;text-align:justify&quot;&gt;We will utilize STOPBEFOREMARK operation to get back deleted records in SQL Server. We cannot utilize this hexadecimal value to implement the operation of STOPBEFOREMARK. Therefore, we want alteration this value into decimal format. Then put all these together as single number.&lt;p/&gt; 
&lt;p&gt;&lt;b&gt;Step 7&lt;/b&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Now implement transaction log backup on database where data was removed if transaction log backup has not competed since data deletion. Then, we will restore the database to other location or on a similar server with the variant name until above LSN. Then, we will import and recover deleted data in SQL Server from newly reinstated database to production database.&lt;/p&gt;  
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW061wtLWS87b-vH837AabDUdjPdiOzakM8lJuDvTlUICRU69zYYaYU-e1XByJVmae8J3U6K4v2ysQrxUpSkRmiJglRJt4FU48Z9y8dGTQMoIlhqWV1QlP71irhp0CRTG2EwN168F508Yw/s1600/7.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW061wtLWS87b-vH837AabDUdjPdiOzakM8lJuDvTlUICRU69zYYaYU-e1XByJVmae8J3U6K4v2ysQrxUpSkRmiJglRJt4FU48Z9y8dGTQMoIlhqWV1QlP71irhp0CRTG2EwN168F508Yw/s1600/7.PNG&quot; data-original-width=&quot;500&quot; data-original-height=&quot;400&quot; /&gt;&lt;/a&gt;
&lt;p&gt;&lt;b&gt;Step 8&lt;/b&gt;&lt;/p&gt; 
&lt;p style=&quot;text-align:justify&quot;&gt;Now, the database is restored, One can check whether you could recover and find deleted records SQL Server or not. Execute the below SELECT statement to preview the first ten rows of location table that was deleted and then retrieve deleted data.&lt;/p&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYGs46qqmKtB0-nJGPjE24gVQbuzHtEw9oJ3V95cM3AIoLCjG0gWSIuZ1k6Nb-ZCm9gp9moMZ5eJdGcp51Iwn7oNrrA0N_aUwyZUKuckUgfqK5lFzrCUsnTI_ETLIbukHfHWdiUP8gYItu/s1600/8.PNG&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYGs46qqmKtB0-nJGPjE24gVQbuzHtEw9oJ3V95cM3AIoLCjG0gWSIuZ1k6Nb-ZCm9gp9moMZ5eJdGcp51Iwn7oNrrA0N_aUwyZUKuckUgfqK5lFzrCUsnTI_ETLIbukHfHWdiUP8gYItu/s1600/8.PNG&quot; data-original-width=&quot;600&quot; data-original-height=&quot;90&quot; /&gt;&lt;/a&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Now you know how to retrieve deleted records in SQL Server with SQL Log Recovery. You can utilize this erased data as per your need. If you need to export this data to live database you can utilize the SQL Server Integration Services, i.e. import and export wizard.&lt;/p&gt;
&lt;h3&gt;SQL Log Recovery become Hard&lt;/h3&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;Above steps can be useful in most of the cases. But several situation may occur when it becomes difficult to restore deleted data with SQL Log recovery. Lets take a look on these situation:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Changes made after the DELETE, TRUNCATE or DROP statments&lt;/li&gt;
&lt;li&gt;Unable to take the SQL Server offline&lt;/li&gt;
&lt;li&gt;New Transactions performed after the data was lost&lt;/li&gt;
&lt;li&gt;No, recent Full Database backup available.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In such situation user can go with third party SQL Log Recovery to successfully restore deleted data records in SQL Server.&lt;/p&gt;

&lt;h3&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/h3&gt;
&lt;p style=&quot;text-align:justify&quot;&gt;After understanding, the users problem how to recover deleted records from SQL Server 2014. In the above discussion, we have discussed the ways to retrieve deleted data from the SQL Server database by Successful SQL LOG Recovery that makes easy for users in restoring SQL Server deleted records in SQL version 2016 / 2014/ 2012 / 2008r2 / 2005 / 2002 and all below version.&lt;/p&gt;
 
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/8677298011306980733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2017/08/sql-server-recover-deleted-records.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8677298011306980733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8677298011306980733'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2017/08/sql-server-recover-deleted-records.html' title='Learn How to Recover Deleted Records from SQL Server 2014'/><author><name>Andrew Jackson</name><uri>http://www.blogger.com/profile/13681691598848401466</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxA_OLacZ-DmmzXEEGAqSgBJa6OGuq1mrvCk5Mx8mF64FRnl_DpGN9Ea7kHqv2kgpGfblJscyp03GR2PQOIqZP1pkFmJwwrSe0h0-oftbA9hx6JRitmdvgY4SGL1cjIqW6FZy6MUpthpd1/s72-c/1.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-3473728948567878767</id><published>2017-07-27T18:21:00.000+05:30</published><updated>2017-07-27T18:21:22.864+05:30</updated><title type='text'>Two Ways to Restore Database from MDF File in SQL Server</title><content type='html'>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In todays decade Relational database Management system became the necessity of the organizations whether they are small level or large level. In such context SQL Server is the best and successful RDBMS which provides highly integrated services to manipulate the SQL database over the Server. As we talk about the SQL Server database the Server provides the primary storage call MDF File, NDF file also known as secondary file, LDF log transaction file. Well, in this section we will discuss about how to restore LDF and MDF files to a database so lets make some prerequisites perform tasks without any trouble.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;First of all detach the database. If you are trying to attach the database which is not detach you will get an error&lt;/li&gt;
&lt;li&gt;Maintain MDF File and LDF file in a specific folder before going to attach&lt;/li&gt;
&lt;li&gt;Locate MDF File and LDF File in the same location&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;There are two ways to restore database from MDF file in SQL Server:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;With the help of SQL Server Management Studio&lt;/li&gt;
&lt;li&gt;Using T-SQL&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;1. Through SQL Server Management Studio follow some steps:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open SSMS and go to object explorer of the database engine instance&lt;/li&gt;
&lt;li&gt;Then make a right click on the database and select Attach option of the list button&lt;/li&gt;
&lt;li&gt;Windows appers, then click  on Add button&lt;/li&gt;
&lt;li&gt;Select the .mdf file and click on OK Button&lt;/li&gt;
&lt;li&gt;Validate the selected files and go to OK Button&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now check the attached database&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. On using T-SQL&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Login to SQL Server database engine&lt;/li&gt;
&lt;li&gt;Go to New Query Window and use Create database with Attach close&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;
    CREATE DATABASE MyDatabase 
    ON (FILENAME = &#39;C:\SQLServer\MyDatabase_Data.mdf&#39;), 
    (FILENAME = &#39;C:\SQLServer\ MyDatabase _Log.ldf&#39;) 
    FOR ATTACH; 
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the above section, we learned how to restore LDF and MDF files to a database. It is highly recommended that you have to detach the MDF file before attaching a new one. This is a very helpful method to restore database from MDF file in SQL Server. The second method performs same task using T- SQL, for the users who needs to attach MDF file through SQL script. In case, if the transaction log file is missing then you can still &lt;a href=&quot;http://www.sqlserverlogexplorer.com/how-to-attach-mdf-file-without-ldf-file/&quot; target=&quot;_blank&quot;&gt;attach MDF file in SQL Server without LDF file&lt;/a&gt; and if the MDF file is not accessible or corrupted then you can &lt;a href=&quot;http://www.sqlrecoverytool.com/&quot; target=&quot;_blank&quot;&gt;repair MDF file&lt;/a&gt; using third party SQL Recovery tools.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/3473728948567878767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2017/07/restore-database-from-mdf-file.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/3473728948567878767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/3473728948567878767'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2017/07/restore-database-from-mdf-file.html' title='Two Ways to Restore Database from MDF File in SQL Server'/><author><name>Andrew Jackson</name><uri>http://www.blogger.com/profile/13681691598848401466</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-4953406969779560706</id><published>2016-09-03T17:42:00.000+05:30</published><updated>2016-09-03T17:43:54.017+05:30</updated><title type='text'>How to Resume Suspended Database Mirroring in SQL Server ?</title><content type='html'>&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.sqlserverlogexplorer.com/database-mirroring-in-sql-server/&quot; target=&quot;_blank&quot;&gt;Database mirroring&lt;/a&gt; is a feature in SQL Server which is creating and maintaining the redundant copies of the database. The purpose behind database mirroring is continuous data availability and minimizes the loss of the data. Redundancy ensures that there is always a one backup copy of the database should remain accessible at the time of updates. 
&lt;/p&gt;
&lt;p&gt;Basically mirroring feature in SQL Server is able to stand the random failures at the several parts when the user is linking between the two servers. It has some in built techniques which are not affected to the outside world. SO the SQL Server user can reboot the servers, connect and reconnect to the link and after that the database mirroring can still be resumed afterwards.&lt;/p&gt;
&lt;h2&gt;Causes for Database Mirroring Pause&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;No storage space in the primary storage.&lt;/li&gt;
&lt;li&gt;SQL Server not working properly. &lt;/li&gt;
&lt;li&gt;The main database is not connected to the mirrored database link.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So, an error is shown to the user while they are performing the database mirroring and all of the sudden it pauses. &lt;/p&gt;
&lt;h3&gt;Methods to Fix Database Mirroring Pause?&lt;/h3&gt;
&lt;p&gt;The above error occurs when the mirror server is running out of the space. The SQL Server user will be able to resume the mirroring as soon as the user frees some space. It means that there is no storage left in the primary storage, so in order to resume the database mirroring the user will check if they have any space in the secondary storage then they will free up all the primary storage and store it to the secondary database in order to resume the database mirroring.&lt;/p&gt;
&lt;h3&gt;Steps to Resume the Database Mirroring In SQL Server&lt;/h3&gt;
&lt;p&gt;Here are the steps to resume database mirroring using SQL Server Management Studio:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First, at the time of database mirroring connect to the principal server instance inside Object Explorer and then click on the server name to expand the server tree.&lt;/li&gt;
&lt;li&gt;Second, expand the databases and click on the database.&lt;/li&gt;
&lt;li&gt;Third, now right click on the database and select Tasks and after that click on Mirror. It will open the mirroring page of the Database properties dialog box.&lt;/li&gt;
&lt;/li&gt;Fourth, if the database is already pause then click on Resume button to resume the database mirroring.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Steps to Resume the Database Mirroring Using Transact-SQL&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Connect to the database engine of the either partner.&lt;/li&gt;
&lt;li&gt;Click on New Query for the standard bar.&lt;/li&gt;
&lt;li&gt;Now Enter the following Transact-SQL query in order to resume the database mirroring:&lt;/li&gt;
&lt;/ul&gt;
&lt;code&gt;ALTER DATABASE testdb SET PARTNER RESUME; &lt;/code&gt;
&lt;p&gt;By the use of this command the user can resume the database mirroring when it was paused.&lt;/p&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;We discussed what is database mirroring and why it is important. In addition, we discussed about what are the causes for database mirroring pause and gave an example for it. We also gave some steps to resume database mirroring using any one of the two platforms. Database mirroring is an important thing as it backups the copy of the database and can be maintained easily at the time of loss of the data or loss of the database file. &lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/4953406969779560706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2016/09/how-to-resume-suspended-database-mirroring.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4953406969779560706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4953406969779560706'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2016/09/how-to-resume-suspended-database-mirroring.html' title='How to Resume Suspended Database Mirroring in SQL Server ?'/><author><name>Andrew Jackson</name><uri>http://www.blogger.com/profile/13681691598848401466</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-8331655666087978373</id><published>2016-01-01T21:28:00.000+05:30</published><updated>2016-01-01T21:28:40.276+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Happy New Year"/><title type='text'>Happy New Year Friends</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Wishing all of you a very Happy New Year. May GOD bless all of you with lots of Success and Happiness.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_hsYzMsWnQGsL80XXJsgjcn0H5lLCXFtUhPwKEET7XUh4NC0fjFu72l5PAmSlXyBaOBWT92WQ2g3ZCmE4MSeJqT6Vf9nbpBS1aAy2YAqwVkreJ061Tx78xgdaCD08Jzu9zP3EK09HELDY/s1600/Happy-New-Year-2016-Images1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_hsYzMsWnQGsL80XXJsgjcn0H5lLCXFtUhPwKEET7XUh4NC0fjFu72l5PAmSlXyBaOBWT92WQ2g3ZCmE4MSeJqT6Vf9nbpBS1aAy2YAqwVkreJ061Tx78xgdaCD08Jzu9zP3EK09HELDY/s400/Happy-New-Year-2016-Images1.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/8331655666087978373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2016/01/happy-new-year-friends.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8331655666087978373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8331655666087978373'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2016/01/happy-new-year-friends.html' title='Happy New Year Friends'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_hsYzMsWnQGsL80XXJsgjcn0H5lLCXFtUhPwKEET7XUh4NC0fjFu72l5PAmSlXyBaOBWT92WQ2g3ZCmE4MSeJqT6Vf9nbpBS1aAy2YAqwVkreJ061Tx78xgdaCD08Jzu9zP3EK09HELDY/s72-c/Happy-New-Year-2016-Images1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-5237958079603846074</id><published>2015-12-31T17:36:00.000+05:30</published><updated>2018-04-03T10:14:43.019+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Recovery"/><title type='text'>SQL Recovery Software: An Ultimate Tool For SQL Database Recovery</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
SQL Server is a database management system which enables to store and retrieve data from the database. Due to some reasons like virus infection, improper closing of the Server, etc. the data in the database may go damaged or corrupted. The recovery of the data can be made possible with &lt;a href=&quot;http://www.systoolsgroup.com/sql-recovery.html&quot;&gt;SQL Recovery Software&lt;/a&gt;. The tool attains an easy recovery of the database files from corruption or damage; no matter how deep the infection is. Both the MDF and NDF files get repaired using the tool and all the triggers, stored procedures, tables, functions, etc. in the database are also recovered within seconds. &lt;br /&gt;
&lt;b&gt;More On Software&lt;/b&gt;&lt;br /&gt;
SQL Repair tool restores all the data from the damaged database file of any server such as; Server 2016, 2014, 2012, 2008, &amp; all below versions. With the software, all the hard deleted data items can be restored without any changes to the data.Being a Windows based software, the tool supports all the versions; Windows 8.1 and below.The Advance scan option recovers entire data when the corruption infection is severe and there is Quick scan mode for minor damage recovery. The tool is supported with the auto-detection option for the selection of NDF files as well as the SQL Server version. Once the restoration of the database files are done, software allows exporting the files back to the Server.&lt;br /&gt;
&lt;b&gt;Overview Of SysTools SQL Recovery Software&lt;/b&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;
  &lt;td align=&quot;center&quot;&gt;Function&lt;/td&gt;
  &lt;td align=&quot;center&quot;&gt;Recover SQL Database from corruption&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;Version&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;6.3&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;Size&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;6.5 MB&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;Server Support&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;SQL Server 2016, 2014, 2012, 2008 R2 / 2008,  2005 &amp; 2000&lt;/td&gt;
  &lt;/tr&gt;
&lt;tr&gt;
    &lt;td align=&quot;center&quot;&gt;Windows Version&lt;/td&gt;
    &lt;td align=&quot;center&quot;&gt;Supports Windows 10 and below&lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;h2&gt;
Outstanding Features of SQL Recovery Software&lt;/h2&gt;
&lt;b&gt;Scan Modes&lt;/b&gt;&lt;br /&gt;
The tool is implemented with advanced algorithms for the recovery of the files. The “Scan Mode” option helps to recover the corrupted or damaged Server database files. The tool supports two scan modes; &lt;b&gt;Quick&lt;/b&gt; and &lt;b&gt;Advance&lt;/b&gt;. If the database file is less corrupted, users can go for “Quick” scan mode or else if the damage is severe, “Advance” scan restores all the data without loss.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwmdNvejTUDkNSvqov85shR1iLuNVA0im2mNZYT9LQd5iiykpaqL1g1KtIv1XUe7H1lM7pZoNfI6e6crEVgAvc-0fG08yPIjy-u4-eT2Y4KIXypFcHKoC3SNIH4JNL5OdQglHP79QPzHgb/s1600/1.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;251&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwmdNvejTUDkNSvqov85shR1iLuNVA0im2mNZYT9LQd5iiykpaqL1g1KtIv1XUe7H1lM7pZoNfI6e6crEVgAvc-0fG08yPIjy-u4-eT2Y4KIXypFcHKoC3SNIH4JNL5OdQglHP79QPzHgb/s400/1.png&quot; width=&quot;400&quot;&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;b&gt;Detects Server Version&lt;/b&gt;&lt;br /&gt;
Suppose, if you don’t know the version of the SQL Server where the database file is saved, there is “Auto detect SQL server file (.mdf) version” choice which will automatically search for the server file version once when the checkbox is ticked. Else, the user can mention the server version directly from the radio options provided but, one should be careful while opting since wrong selection of the server may lead to inconsistency.&lt;br /&gt;
&lt;b&gt;NDF File Scan Option&lt;/b&gt;&lt;br /&gt;
The users can either add multiple files or folders for scanning and recovering. If the added files are to be removed, the tool is sufficient with that feature too. The eminent feature of the &lt;b&gt;NDF option&lt;/b&gt; is that, it automatically detects the NDF files when the &lt;b&gt;“Autodetect the SQL server secondary database (.ndf) files”&lt;/b&gt; option is selected. If the user doesn’t know the location of the file, auto-detect feature will be of useful; both to search the file and save time. Else, the user can select and provide the files using the &lt;b&gt;“Let me choose the SQL Server secondary database (.ndf) files” choice&lt;/b&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuMHi9tYmhaOKQFdyH6Ex4PDae-hRPIwp_eyI-KO9PiG6oPiVg4sQi7a1-bh1uRJmdPruzyIdlIXfPtSHQNJD3R-5m5ZH4MlKD287XIFzUW4H3rO6MxGnwGBK-wyFX6nXa2rlDIEgm58Dd/s1600/2.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuMHi9tYmhaOKQFdyH6Ex4PDae-hRPIwp_eyI-KO9PiG6oPiVg4sQi7a1-bh1uRJmdPruzyIdlIXfPtSHQNJD3R-5m5ZH4MlKD287XIFzUW4H3rO6MxGnwGBK-wyFX6nXa2rlDIEgm58Dd/s400/2.png&quot; width=&quot;400&quot;&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;b&gt;Hierarchical Structure&lt;/b&gt;&lt;br /&gt;
After the restoration of the database files, it shows the content of the files in hierarchical manner. The software will show all the contents such as; stored procedures, tables, triggers, functions, rules, etc. and each of the contents is expandable too. The structuring makes the viewing comfortable and easy. &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7vzia0URFQJoVJf5irWHm2uWNqNn0OnmeiUAXOSY8gsOaUz0UCOqLFbYANwt9iLRs2AjvgSiLs4Y4PRHMDcnqSkcSqQa_p2yuUTNFd615JMNQMnx_mvT8lJG3B4zEVwd4a7yfOh006oc/s1600/3.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgV7vzia0URFQJoVJf5irWHm2uWNqNn0OnmeiUAXOSY8gsOaUz0UCOqLFbYANwt9iLRs2AjvgSiLs4Y4PRHMDcnqSkcSqQa_p2yuUTNFd615JMNQMnx_mvT8lJG3B4zEVwd4a7yfOh006oc/s400/3.png&quot; width=&quot;400&quot;&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;b&gt;Export Modes&lt;/b&gt;&lt;br /&gt;
Once when the files or folders are recovered from the damage, the tool allows exporting the recovered files back to the database itself. Either the user can export to &lt;b&gt;“SQL Server Database”&lt;/b&gt; or to &lt;b&gt;“SQL Server Compatible SQL Scripts”&lt;/b&gt;. If the user chooses the first option then, will have to provide the server name, database name, the credentials of the server. But, the latter option is usually opted when the server is not present or files are not to be exported to the server for time being. The &lt;b&gt;“SQL Server Compatible SQL Scripts”&lt;/b&gt; choice will save the files in scripts and user can later transport the scripts.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF04grjG5dOZLgVYL3aiwFPZ8vptL3Aq6-JFHvdCJRk9c0st5W4xxWwWJue47vCIPUmXys_IRebeR0cWSoxN0RKVmcnPrNq7sv4PtAEoNPzy0iawvTSbcgVYuTEKqi02XO5GKXcjlyVq98/s1600/4.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF04grjG5dOZLgVYL3aiwFPZ8vptL3Aq6-JFHvdCJRk9c0st5W4xxWwWJue47vCIPUmXys_IRebeR0cWSoxN0RKVmcnPrNq7sv4PtAEoNPzy0iawvTSbcgVYuTEKqi02XO5GKXcjlyVq98/s400/4.png&quot; width=&quot;400&quot;&gt;&lt;/a&gt;
&lt;br /&gt;
Dual Export Option&lt;br /&gt;
While exporting the database files to the server or when saving in script forms, the tool facilitates the users with two options. User can export the files either &lt;b&gt;“With only Schema”&lt;/b&gt; or &lt;b&gt;“With Schema &amp;amp; Data” &lt;/b&gt;options. Both these options are applicable for both the exports i.e. to SQL Server Database or SQL Server Compactible SQL Scripts.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7X4qKSq0YRJ9MROXrI7J8nWr9RQVb2s675wexRYXhJ5HJoutHwAOJZ6i_VQGA4RUPF50dpMYlUyrMakujrLr6iKMw4OK_xfcwxP_v6G7DIyAwSIlw5lAXEP5nzA7zFm3FaDbNPq_BdnHI/s1600/5.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;250&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7X4qKSq0YRJ9MROXrI7J8nWr9RQVb2s675wexRYXhJ5HJoutHwAOJZ6i_VQGA4RUPF50dpMYlUyrMakujrLr6iKMw4OK_xfcwxP_v6G7DIyAwSIlw5lAXEP5nzA7zFm3FaDbNPq_BdnHI/s400/5.png&quot; width=&quot;400&quot;&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;b&gt;Versions &amp;amp; Its Extents&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Demo Version&lt;/b&gt;&lt;br /&gt;
The capability of the application can be checked using the demo version available. If the user is satisfied will the working then, can go for the purchase option. But, the demo version is limited to the recovery of the files. The exporting and saving cannot be done with the demo version.&lt;br /&gt;
&lt;b&gt;License Version &lt;/b&gt;&lt;br /&gt;
Along with the demo version, the full version is also available in the office website. The Licensed version recovers all the added files or folders and enables to export and save the restored files back to the server, if needed. &lt;br /&gt;
&lt;b&gt;Pros &amp;amp; Cons&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Pros:&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Supports the recovery of both .ndf and .mdf files from damages or corruptions.&lt;/li&gt;
&lt;li&gt;Enables to scan multiple .ndf files at a time.&lt;/li&gt;
&lt;li&gt;Automatically selects the SQL Server version for the MDF files, if unknown.&lt;/li&gt;
&lt;li&gt;Two scanning modes for the recovery of the files.&lt;/li&gt;
&lt;li&gt;Selects the NDF files automatically, if the user doesn’t know the location.&lt;/li&gt;
&lt;li&gt;Exports retrieved files back to Server database or saves in Compatible SQL Scripts.&lt;/li&gt;
&lt;li&gt;Provides facility for exporting either schema only or both schema and data together.
&lt;/li&gt;
&lt;/ul&gt;
&lt;b&gt;Cons:&lt;/b&gt;&lt;br /&gt;
Doesn’t scan and recover LDF files of the database&lt;br /&gt;
&lt;b&gt;The Verdict&lt;/b&gt;&lt;br /&gt;
In the technical point of view, the tool is equipped with all the sufficient features for the recovery of the database files. On the basis of its working, software can be rated as 9.6/10. Though the tool doesn’t recover LDF files, it efficiently restores both MDF and NDF files which are more important than the LDF files. For the repairing of the database files from damage, users can depend on the SQL Recovery Software without a second thought.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/5237958079603846074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/12/sql-recovery-software-for-database-recovery.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5237958079603846074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5237958079603846074'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/12/sql-recovery-software-for-database-recovery.html' title='SQL Recovery Software: An Ultimate Tool For SQL Database Recovery'/><author><name>Andrew Jackson</name><uri>http://www.blogger.com/profile/13681691598848401466</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwmdNvejTUDkNSvqov85shR1iLuNVA0im2mNZYT9LQd5iiykpaqL1g1KtIv1XUe7H1lM7pZoNfI6e6crEVgAvc-0fG08yPIjy-u4-eT2Y4KIXypFcHKoC3SNIH4JNL5OdQglHP79QPzHgb/s72-c/1.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-4130494084740819477</id><published>2015-08-15T14:12:00.001+05:30</published><updated>2015-08-15T14:14:56.123+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Happy Independence Day"/><title type='text'>Happy Independence Day - Jai Hind</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&lt;span style=&quot;color: orange;&quot;&gt;Wishing&lt;/span&gt; &lt;span style=&quot;color: orange;&quot;&gt;you&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;a very&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif; font-size: x-large;&quot;&gt;&lt;b style=&quot;background-color: #d9ead3;&quot;&gt;&lt;span style=&quot;color: orange;&quot;&gt;Happy&lt;/span&gt; &lt;span style=&quot;color: white;&quot;&gt;Independence&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;Day&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Georgia, Times New Roman, serif; font-size: x-large;&quot;&gt;&lt;b style=&quot;background-color: #d9ead3;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #fcfcfc; color: #666666; font-family: Georgia; font-style: italic; line-height: 22.5px; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&quot; We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made. &quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;su-quote-cite&quot; style=&quot;background-color: #fcfcfc; color: #666666; display: block; font-family: Georgia; line-height: 22.5px; text-align: right;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Albert Einstein&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE6SZXkoM0vFo4V1BHxkxXlIwgwmzKoUbl1diLUgTh1YaXQOnjIf1ymXGSVqEf6SQ8qVyy2e1YPUrN3VZAt_xYfoCzFVASfrqg0SJM9RnGb4nyI-rPrzxnT_BQM-TAzgka2qYadsVo4v6u/s1600/Indiaindependenceday.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE6SZXkoM0vFo4V1BHxkxXlIwgwmzKoUbl1diLUgTh1YaXQOnjIf1ymXGSVqEf6SQ8qVyy2e1YPUrN3VZAt_xYfoCzFVASfrqg0SJM9RnGb4nyI-rPrzxnT_BQM-TAzgka2qYadsVo4v6u/s400/Indiaindependenceday.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: orange;&quot;&gt;Some facts &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;about India&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Indus Valley&amp;nbsp;Civilization&amp;nbsp;is the world’s oldest&amp;nbsp;civilization.So, India is the world’s oldest,&amp;nbsp;most advanced and continuous&amp;nbsp;civilization.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;India has the world’s third largest active army, after China and USA but India has never invaded or attacked a country.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Today, India is the world’s third largest economy.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;The Tirupati Balaji temple and the Kashi Vishwanath Temple both, receive more visitors than the Vatican City and Mecca combined.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Every 12 years, a religious gathering called the Kumbh Mela occurs in India. It is the world’s largest gathering of people.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Varanasi, also known as Benaras, was called &quot;the Ancient City&quot; when Lord Buddha visited it in 500 B.C., and is the oldest, continuously inhabited city in the world today.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;India has third largest Muslim population in the world and has more mosques (300,000 mosques) than any other nation in the world.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Jews and Christians have lived continuously in India since 200 B.C. and 52 A.D. respectively&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Two major religions, Buddhism and Jainism, were established in India.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Takshila is said to be the first every university in the world; it started around 700 BC.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;Indian Railways employs more than 1.3 million people. That’s more than the population of many nations.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;India is the largest democracy in the world. More than 54 crore people voted in the 2014 General Election – more people than the population of USA, UK, Australia and Japan combined.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: orange; font-family: Verdana, sans-serif;&quot;&gt;India has the largest English speaking population in the world.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;India’s space program is one of the top 5 space programs in the world and&amp;nbsp;off course&amp;nbsp;we invented water on the moon.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;Chess was invented in India.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;And discovered the number zero.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;And the value of pi.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;And trigonometry, algebra, calculus.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;Ayurveda is the earliest school of medicine known to mankind. The Father of Medicine, Charaka, consolidated Ayurveda 2500 years ago.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;Cataract surgery and plastic surgery are invented in India&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;Around the 17th century, India was one of the richest countries in the world.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;India is one of the only three countries that makes supercomputers (the US and Japan are the other two).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;India has the largest amount of vegetarians in the world. So much so that Pizza Hut had to open their first pure vegetarian restaurant in the country and KFC had to introduce a “vegetarian” menu for India.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;India gave the world Yoga, that has existed for more than 5,000 years.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;Martial Arts was first created in India.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: Georgia, Times New Roman, serif; font-size: x-large;&quot;&gt;&lt;span style=&quot;color: orange;&quot;&gt;Proud To &lt;/span&gt;&lt;span style=&quot;color: orange;&quot;&gt;Be&lt;/span&gt;&lt;span style=&quot;color: orange;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;An Indian&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif; font-size: x-large;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;su-quote-cite&quot; style=&quot;background-color: #fcfcfc; display: block; font-family: Georgia; font-size: 16px; line-height: 22.5px; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/4130494084740819477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/happy-independence-day-jai-hind.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4130494084740819477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/4130494084740819477'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/happy-independence-day-jai-hind.html' title='Happy Independence Day - Jai Hind'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiE6SZXkoM0vFo4V1BHxkxXlIwgwmzKoUbl1diLUgTh1YaXQOnjIf1ymXGSVqEf6SQ8qVyy2e1YPUrN3VZAt_xYfoCzFVASfrqg0SJM9RnGb4nyI-rPrzxnT_BQM-TAzgka2qYadsVo4v6u/s72-c/Indiaindependenceday.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-5676018586776231599</id><published>2015-08-14T16:04:00.003+05:30</published><updated>2015-08-14T16:04:53.701+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL query to find triggers"/><title type='text'>SQL Script to find all the triggers defined on a database or on a single table</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Sometime we need to find all the triggers defined on the database. So in this case, we can use the below SQL Query:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SELECT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tbl.name as [Table Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;, trig.name as [Trigger Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;, trig.is_disabled&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;FROM [sys].[triggers] as trig&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;INNER JOIN sys.tables as tbl&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;ON trig.parent_id = tbl.object_id&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;In case, if we need to find out all the triggers defined on a particular table then we can use the below SQL script&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SELECT&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;tbl.name as [Table Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;, trig.name as [Trigger Name]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;, trig.is_disabled&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;FROM [sys].[triggers] as trig&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;inner join sys.tables as tbl&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;on trig.parent_id = tbl.object_id&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;where tbl.name=&#39;Tblname&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;/* &amp;nbsp;where Tblname name is the name of the table*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Related article&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://www.techmixing.com/2011/11/sql-triggers-introduction.html&quot; target=&quot;_blank&quot;&gt;SQL Triggers - An Introduction&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Keep learning and don&#39;t forget to gives feedback on the article. You can also send feedback to me on my mailid &amp;nbsp;&lt;b&gt;askvivekjohari@gmail.com&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/5676018586776231599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/sql-script-to-find-all-triggers-defined.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5676018586776231599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5676018586776231599'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/sql-script-to-find-all-triggers-defined.html' title='SQL Script to find all the triggers defined on a database or on a single table'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-8733151460650612867</id><published>2015-08-13T12:33:00.001+05:30</published><updated>2015-08-13T16:31:15.796+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CodeProject"/><category scheme="http://www.blogger.com/atom/ns#" term="Is Clustured index on column with duplicate values possible"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Indexes"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Interview Questions"/><title type='text'>Interview question - Is Clustered index on column with duplicate values possible?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Through this article, we are going to discuss three important interview questions of SQL which are given below:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;1) Can we create clustered index on a&amp;nbsp;column&amp;nbsp;containing&amp;nbsp;duplicate values?&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;2) Can we create a Primary Key on a table on which a clustered index is already defined?&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;3) If a clustered index is already defined on a table and we create a primary key on this table, then is there any index is automatically&amp;nbsp;created on the column on which Primary key is defined?&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Many people say no for first question as they always consider&amp;nbsp;clustered&amp;nbsp;index and Primary key together and primary key can&amp;nbsp;only be created on column with unique and not null values. Since primary key and clustered index combination is always consider as best combination like made in heaven so many people thought clustered index can only be created on the column on which primary key is created.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
But this is not correct. We can create clustered index on the columns on which primary key is not defined or in simple words clustered index can be created on the non primary key column of a table. We know that when we defined primary key, a clustered index is created on the column / columns&amp;nbsp;automatically by default. But if a clustered index is already defined for the table and we created the primary key latter then clustered index is not created on the primary key column as only one clustered index can be possible for a table which is in this case, already defined. So Primary key and clustered index are both different objects in SQL. Uniqueness is must in case of Primary key but it is not a must condition in case of Clustered Index.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; text-align: -webkit-left; text-indent: 0px; widows: 2;&quot;&gt;
&lt;span style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
For example,&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Suppose we have a table called&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;tbl_clustered&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;whose&amp;nbsp;structure&amp;nbsp;is given below:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;
create table tbl_clustered (Id int identity(1,1), Empname nvarchar(200 ))&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Below is the data inserted &amp;nbsp;query to insert data in the table&amp;nbsp;tbl_clustered&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Insert into&amp;nbsp;tbl_clustered&amp;nbsp;(Empname&amp;nbsp;)&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Values&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
(&#39;Kumar&#39;),&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
(&#39;Gupta&#39;),&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
(&#39;Arora&#39;),&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;(&#39;Gupta&#39;),&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
(&#39;Gupta&#39;)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;
Now let see the data inserted into the table using the below query&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select * from&amp;nbsp;tbl_clustered&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Result:-&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Id&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Empname&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;1&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Kumar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;2&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Gupta&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;3&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Arora&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;4&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Gupta&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; widows: 2;&quot;&gt;
&lt;span style=&quot;color: #38761d; font-family: Verdana, sans-serif;&quot;&gt;5&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Gupta&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;So till now, we have created a table and inserted some data in it. ID column is the identity column and Empname &amp;nbsp;is varchar type column and we inserted some duplicate values in the Empname column.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Some people thought when we create an Identity column, primary key is automatically created on it. This is wrong. We usually create primary key on Identity column as it contains unique and not null value but primary key is not created on it by default unless we create it manually.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Let see the table structure to make sure that no primary &amp;nbsp;key or&amp;nbsp;clustered index is created on the table yet.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;To see the table structure, we use the following command:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;sp_help&amp;nbsp;tbl_clustered&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhli56_RWZdekCWx6sghEFNSkCvfyT-QXPPDe1z89LtNLSHb6Q6Fjwi28RfSgZCKO2nA6jTfV_0e6c1pADMvM7_4U3J1E7K2KPepoe7M8g1MJaEszjIH4I1Qz4K7mqcQhZy3FWk7IlaC7c1/s1600/table_detailed_1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;180&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhli56_RWZdekCWx6sghEFNSkCvfyT-QXPPDe1z89LtNLSHb6Q6Fjwi28RfSgZCKO2nA6jTfV_0e6c1pADMvM7_4U3J1E7K2KPepoe7M8g1MJaEszjIH4I1Qz4K7mqcQhZy3FWk7IlaC7c1/s400/table_detailed_1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Now lets create a clustered index on the table&amp;nbsp;tbl_clustered.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;create&amp;nbsp;clustered&amp;nbsp;index&amp;nbsp;inx_clux_test&amp;nbsp;on&amp;nbsp;tbl_clustered(&amp;nbsp;Empname&amp;nbsp;)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Above command will create the clustered index&amp;nbsp;successfully&amp;nbsp;irrespective of the fact that Empname column contains&amp;nbsp;the duplicate values.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Let again check the table structure again&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;sp_help&amp;nbsp;tbl_clustered&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAsZ5HT8iqvyXLs58eaVQdgg6idiKSeY_sg9eR1S8rmV6nYMMgH9ZYQjpaFoR9SjBDAp7R8Aa6RmYO6-XAMBHoxpvO0HFtC0y5Sf11UaXP03BYhZ-lfFIW31A45UcPMe734KlBjaNukcKg/s1600/table_detailed_2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;187&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAsZ5HT8iqvyXLs58eaVQdgg6idiKSeY_sg9eR1S8rmV6nYMMgH9ZYQjpaFoR9SjBDAp7R8Aa6RmYO6-XAMBHoxpvO0HFtC0y5Sf11UaXP03BYhZ-lfFIW31A45UcPMe734KlBjaNukcKg/s400/table_detailed_2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;If you see the above picture, you can find the details of clustered index in the last row.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Now let create a Primary key on the table to show that if a clustered index is already created on a table and then we try to create a primary key then the primary key is created but without any clustered index.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;let create the primary key using the below script&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Alter&amp;nbsp;table&amp;nbsp;tbl_clustered&amp;nbsp;add&amp;nbsp;primary&amp;nbsp;key&amp;nbsp;(&amp;nbsp;id)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Let see the table details again to check is any clustered index is created on the primary key column when we defined the primary key in the table.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidlTSwBDup4GlPJuJBPfOjiqoltd82xJhpWSNE-s-IDe9Lni9BCFJ6CKsNiYdZxq-ayfYPARnlX-clOrD7JgT3fS1tNMYBSAs-KdMVcMzGq-ZYjFUhDmGMRcbv4S7vrW0QI5mM2khM0Ixp/s1600/table_detailed_3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidlTSwBDup4GlPJuJBPfOjiqoltd82xJhpWSNE-s-IDe9Lni9BCFJ6CKsNiYdZxq-ayfYPARnlX-clOrD7JgT3fS1tNMYBSAs-KdMVcMzGq-ZYjFUhDmGMRcbv4S7vrW0QI5mM2khM0Ixp/s400/table_detailed_3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;If we see the above picture, we got to know, if we create a primary key on table on which a clustered index is already defined, then a non clustered index is created automatically on the primary key column. So the table has two indexes&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Clustered Index defined manually by us on the table intially&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Non clustered index created automatically with the creation of primary key on the column on which Primary key is defined.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Summary:-&lt;/b&gt;Through this article, I tried to show that primary key and clustered index are the different objects. We can create a clustered index on the column which contains duplicate values but primary key can only be created on the column which&amp;nbsp;contains unique and not null values. Also, if a clustered index is already defined on a table and we try to create a primary on the table then a non-clustered index is created on the column on which the primary key is defined(instead of clustered index). But we should try to design the database so that clustered index is&amp;nbsp;created&amp;nbsp;on the primary key&amp;nbsp;as we mostly use primary key in Joins conditions. Also primary key is&amp;nbsp;referred&amp;nbsp;by the foreign keys. So clustered index on the primary key helps in increasing the database performance.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-weight: normal;&quot;&gt;You can refers the following articles for better understanding of the concepts used in this&amp;nbsp;article&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;For Primary Keys&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2009/08/different-constraints-in-sql-server.html&quot; target=&quot;_blank&quot;&gt;Sql server Constraints - Primary Key, Foreign Key, Unique Key, Not Null, Check Constraints&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2009/10/difference-between-primary-key-and.html&quot; target=&quot;_blank&quot;&gt;Difference between Primary key and Unique key&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;For Indexes:-&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2010/01/indexes-in-sql-server.html&quot; target=&quot;_blank&quot;&gt;Indexes in Sql server&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;a href=&quot;http://www.techmixing.com/2010/01/difference-between-clustered-and.html&quot; target=&quot;_blank&quot;&gt;Difference between Clustered Index and Non clustered Index&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Keep learning and don&#39;t forget to gives feedback on the article. You can also send feedback to me on my mailid &amp;nbsp;&lt;b&gt;askvivekjohari@gmail.com&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/8733151460650612867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/interview-question-is-clustured-index.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8733151460650612867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/8733151460650612867'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/interview-question-is-clustured-index.html' title='Interview question - Is Clustered index on column with duplicate values possible?'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhli56_RWZdekCWx6sghEFNSkCvfyT-QXPPDe1z89LtNLSHb6Q6Fjwi28RfSgZCKO2nA6jTfV_0e6c1pADMvM7_4U3J1E7K2KPepoe7M8g1MJaEszjIH4I1Qz4K7mqcQhZy3FWk7IlaC7c1/s72-c/table_detailed_1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-597711701538504502</id><published>2015-08-03T15:20:00.002+05:30</published><updated>2015-08-03T15:20:17.479+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Question of the Month"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Interview Questions"/><title type='text'>Question of the Month (July) </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #222222; widows: 1;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Suppose we have a table&amp;nbsp;emp_plan&amp;nbsp; which contains 4 columns &quot;Empid&quot; (employeeid), Planid (Projectid), Startdate(Allocation Start date) and Enddate (Allocation Enddate). Its structure is given below:-&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;background-color: white; widows: 1;&quot;&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Create table emp_plan (empid nvarchar(200),planid nvarchar(20),startdate datetime, enddate datetime)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Also below is the script to enter sample data into the table:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;insert into emp_plan(empid,planid,startdate,enddate)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planA&#39;,&#39;2015-05-15&#39;,&#39;2015-05-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planA&#39;,&#39;2015-05-31&#39;,&#39;2015-06-14&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planA&#39;,&#39;2015-06-15&#39;,&#39;2015-06-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planA&#39;,&#39;2015-07-10&#39;,&#39;2015-07-20&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planA&#39;,&#39;2015-07-21&#39;,&#39;2015-07-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planB&#39;,&#39;2015-06-14&#39;,&#39;2015-06-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planB&#39;,&#39;2015-07-10&#39;,&#39;2015-07-20&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;001&#39;,&#39;planB&#39;,&#39;2015-07-21&#39;,&#39;2015-07-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;002&#39;,&#39;planA&#39;,&#39;2015-06-14&#39;,&#39;2015-06-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;002&#39;,&#39;planB&#39;,&#39;2015-07-10&#39;,&#39;2015-07-20&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;union all&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select &#39;002&#39;,&#39;planB&#39;,&#39;2015-07-21&#39;,&#39;2015-07-30&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;So the data contain in the table is given blow:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh4hKkZ0iYksJozbzl4SSbeJz_kg5-V81zr-vRGRHPtCBKccnwIa9N7Kj3-_tyUS_LNuahX_Gt4IlpiJy4c8LnXxsQgBagQL8qDAIE4M2t-xg5WMrQehRS8skUC-gEFunhrDR5XOvzBtU-/s1600/emp_plandata.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;230&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh4hKkZ0iYksJozbzl4SSbeJz_kg5-V81zr-vRGRHPtCBKccnwIa9N7Kj3-_tyUS_LNuahX_Gt4IlpiJy4c8LnXxsQgBagQL8qDAIE4M2t-xg5WMrQehRS8skUC-gEFunhrDR5XOvzBtU-/s400/emp_plandata.png&quot; width=&quot;400&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Now if a employee has the same project(planid) with no gap in the next allocation segment( allocation segment means from allocation startdate to allocation enddate), then we need to join the continuous allocation segment. For example if you see the data in the table, in the first 3 rows, employee having empid 001 is allocated to the Same project (PlanA) and all allocation segments are continuous (from&amp;nbsp;2015-05-15 to&amp;nbsp;2015-06-30)&amp;nbsp;&amp;nbsp;as shown below:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2015-05-15 to 2015-05-30 &amp;nbsp;(1st row)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2015-05-31 to 2015-06-14 &amp;nbsp;(2nd row)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2015-06-15 to 2015-06-30 &amp;nbsp;(3rd row)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;But the 4th row contains allocation segment which is not not continuous with the above 3 allocation segments as there is a gap between the 3rd row enddate and 4th row startdate and again 4th row is in continuation with 5th row with same employeeid 001 and project id (Plan1) as shown below:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2015-07-10 &amp;nbsp;to 2015-07-20 (4th Row)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2015-07-21 to 2015-07-30 (5th Row)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 1;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: #222222;&quot;&gt;So expect&amp;nbsp;result set&amp;nbsp;should be&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Empid &amp;nbsp; &amp;nbsp; Planid &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Startdate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Enddate&lt;/b&gt;&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-05-15 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-30 00:00:00.000&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;(1st to 3rd Row)&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-10 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-30 00:00:00.000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(4th to 5th Row)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;So according to the above rule, expected result from the sample data inserted into the table (as shown in the above picture), should be same as given below:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Expected Result&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;b&gt;Empid &amp;nbsp; &amp;nbsp; Planid &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Startdate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Enddate&lt;/b&gt;&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-05-15 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-30 00:00:00.000&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-10 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-30 00:00:00.000&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-14 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-30 00:00:00.000&lt;br /&gt;
001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-10 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-30 00:00:00.000&lt;br /&gt;
002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-14 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-06-30 00:00:00.000&lt;br /&gt;
002 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;planB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-10 00:00:00.000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2015-07-30 00:00:00.000&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-stroke-width: 0px; color: #222222; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #111111;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;So what should be the query/stored procedure to get the above result?&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/597711701538504502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/question-of-month-july.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/597711701538504502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/597711701538504502'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/08/question-of-month-july.html' title='Question of the Month (July) '/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh4hKkZ0iYksJozbzl4SSbeJz_kg5-V81zr-vRGRHPtCBKccnwIa9N7Kj3-_tyUS_LNuahX_Gt4IlpiJy4c8LnXxsQgBagQL8qDAIE4M2t-xg5WMrQehRS8skUC-gEFunhrDR5XOvzBtU-/s72-c/emp_plandata.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-7630842282818775869</id><published>2015-07-11T15:45:00.000+05:30</published><updated>2015-07-11T15:45:15.817+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Smartphones"/><category scheme="http://www.blogger.com/atom/ns#" term="SocialNetworking"/><category scheme="http://www.blogger.com/atom/ns#" term="Whatsapp"/><title type='text'>Do you know about Whatsapp web?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
Whatsapp claims that they currently have 500 million users worldwide. That is pretty impressive looking at the good amount of distinctively decent competitors they have within the space of Social Networking communication.&amp;nbsp;&lt;a href=&quot;http://www.viber.com/&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;Viber&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://line.me/download&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;Line&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://www.google.com/hangouts/&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;Google Hangout&lt;/a&gt;,&lt;a href=&quot;https://www.messenger.com/&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;Facebook Messenger&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href=&quot;http://get.hike.in/&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;Hike&lt;/a&gt;&amp;nbsp;(Commonly in India). While all these products are growing inch by inch and including new set of features into their product, whatsapp has never really seen any major makeover or a big release since Facebook took it over. Changing the paradigm, Whatsapp’s Web version has been introduced recently. Let us review and assess do we have got a Cherry with an already delicious pineapple cake or a bitter cup?&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
To begin using Whatsapp web, you would have to follow few steps&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
&lt;b style=&quot;box-sizing: border-box;&quot;&gt;1. Update your whatsapp application to the latest version: &amp;nbsp;&lt;/b&gt;Right now, the web version is only compatible with Google Chrome when paired with the Android, Windows Phone, or Blackberry version of the mobile app. iOS users sadly have to wait for some more time till they see the sunrise.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
&lt;b style=&quot;box-sizing: border-box;&quot;&gt;2. Pairing:&amp;nbsp;&lt;/b&gt;The process of bringing whatsapp to the Desktop shall begin by pairing the Web version with the Whatsapp Mobile Application.&amp;nbsp;&amp;nbsp;To pair your mobile application, navigate to Web version of Whatsapp by typing in&amp;nbsp;&lt;a href=&quot;http://web.whatsapp.com/&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot;&gt;http://web.whatsapp.com&lt;/a&gt;&amp;nbsp;on your browser’s Address bar. You shall view a similar interface as below&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px;&quot;&gt;
&lt;div style=&quot;box-sizing: border-box; margin-bottom: 10px;&quot;&gt;
&lt;a href=&quot;http://www.spellbytes.com/wp-content/uploads/2015/07/whatsapp2.jpg&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot;&gt;&lt;img alt=&quot;Whatsapp web screenshot&quot; class=&quot;size-large wp-image-49 img-responsive&quot; height=&quot;456&quot; src=&quot;http://www.spellbytes.com/wp-content/uploads/2015/07/whatsapp2-1024x584.jpg&quot; style=&quot;border: 0px; box-sizing: border-box; display: initial; height: auto; max-width: 100%; vertical-align: middle;&quot; width=&quot;800&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
&lt;b style=&quot;box-sizing: border-box;&quot;&gt;&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;/b&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;&lt;/b&gt;Now, open the Whatsapp application on your Android mobile and open Menu. You shall be prompted to scan the QR code present on the Chrome window (As depicted in figure above).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
Note: QR code(abbreviated from Quick Response Code)&amp;nbsp;is a complex matrix of coded information represented in a square shape. If you want to know more about QR code, head&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/QR_code&quot; style=&quot;background: transparent; box-sizing: border-box; color: #428bca; text-decoration: none; word-break: break-word;&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
Point your mobile so that QR Code can be seen within your mobile and fits within Scan area. The Mobile shall automatically pair the web version of whatsapp to load the similar view on web view.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
Once you are in, you can search for your friends in the similar fashion as you’d do from your mobile. You can send messages, share images. You also have the option to record your voice using the Microphone button, that is placed exactly where you’d observe on your mobile version (Adjacent to message type-in area).&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
The only thing that I really miss is the ability of Web version to forward the received messages. Hopefully, whatsapp should be able to bring this feature soon. Till then, you can still enjoy the luxury of keep plugged on your desktop, without your boss knowing that you are still “&lt;i style=&quot;box-sizing: border-box;&quot;&gt;Whatsapp Phantom&lt;/i&gt;“.&lt;/div&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #333333; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 20px; margin-bottom: 10px;&quot;&gt;
&lt;a href=&quot;http://www.spellbytes.com/android/do-you-know-about-whatsapp-web/&quot; target=&quot;_blank&quot;&gt;Original Source&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/7630842282818775869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/do-you-know-about-whatsapp-web.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/7630842282818775869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/7630842282818775869'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/do-you-know-about-whatsapp-web.html' title='Do you know about Whatsapp web?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-2254134102147056587</id><published>2015-07-10T23:28:00.001+05:30</published><updated>2015-07-10T23:28:27.163+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Date time functions"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><title type='text'>Script to find complete months between two given dates</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Below script will help in finding the complete months within the 2 given dates. In the below script we takes below dates as example&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Startdate =2015-07-05&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Enddate =2016-01-06&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;/**********************Script Start**************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;IF (object_id(&#39;tempdb..#month&#39;) is not null)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;DROP TABLE #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;CREATE TABLE #month (id int identity(1,1),MonthStartDate DATETIME,MonthEndDate DATETIME)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;DECLARE @startdate AS DATETIME&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;DECLARE @enddate AS DATETIME&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;DECLARE @monthstartdate AS DATETIME&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;DECLARE @monthenddate AS DATETIME&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SET @startdate=&#39;2015-07-05&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SET @enddate=&#39;2016-01-06&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SELECT @monthstartdate= dateadd(mm,1,dateadd(DD,-day(@startdate)+1,@startdate))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SELECT @monthenddate= dateadd(dd,-1,dateadd(mm,1,@monthstartdate))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;IF @enddate&amp;lt;@monthenddate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; INSERT INTO #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; SELECT null,null&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;ELSE IF @startdate=@monthstartdate and @enddate=@monthenddate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; INSERT INTO #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; SELECT @monthstartdate,@monthenddate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;ELSE IF (@enddate&amp;gt;@monthenddate)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; IF @startdate=@monthstartdate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; INSERT INTO #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; SELECT @monthstartdate,@monthenddate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; END&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; WHILE (@enddate&amp;gt;=@monthenddate)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;INSERT INTO #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;SELECT @monthstartdate,@monthenddate&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;SELECT @monthstartdate=dateadd(MM,1,@monthstartdate)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;SELECT @monthenddate=dateadd(day,-1,dateadd(MM,1,@monthstartdate))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SELECT cast(MonthStartDate as DATE) as MonthStart,cast(MonthEndDate as DATE) as MonthEnd FROM #month&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;/**********************Script End**************************/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This script will gives the following result:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;MonthStart&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;MonthEnd&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-08-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-08-31&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-09-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-09-30&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-10-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-10-31&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-11-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-11-30&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-12-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2015-12-31&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/2254134102147056587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/script-to-find-complete-months-between.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/2254134102147056587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/2254134102147056587'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/script-to-find-complete-months-between.html' title='Script to find complete months between two given dates'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-358199046814274418</id><published>2015-07-10T22:55:00.003+05:30</published><updated>2015-07-10T22:55:51.329+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBA Scripts"/><category scheme="http://www.blogger.com/atom/ns#" term="Sql Server"/><title type='text'>Script to find the complete weeks within two given dates</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Sometimes we need to find out the complete weeks within two given dates. Below script will help in finding the complete weeks within 2 given dates. In this script, I have used below dates as example&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Startdate=2015-04-12&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Enddate=2015-06-10&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;SET DATEFORMAT YMD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;if (object_id(&#39;tempdb..#weekdays&#39;) is not null)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;drop table #weekdays&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Declare @StartDate as datetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Declare @EndDate as datetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Declare @Initialweekstart as datetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Declare @weekstart as datetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Declare @weekend as datetime&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;declare @day as int&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;set @StartDate=&#39;2015-04-12&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;set @EndDate=&#39;2015-06-10&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;Create table #weekdays(weekstart datetime, weekend datetime)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select @Initialweekstart=dateadd(wk, datediff(wk, 0, @StartDate), 0)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;if @Initialweekstart&amp;lt;@StartDate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;set @weekstart= DATEADD(wk,1,DATEADD(wk,DATEDIFF(wk,0,@Initialweekstart),0))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print &amp;nbsp;@weekstart&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;set @weekend=DATEADD(dd,6,@weekstart)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;set @weekstart=@Initialweekstart&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;set @weekend=DATEADD(dd,6,@weekstart)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;while @weekend&amp;lt;=@EndDate&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; insert into #weekdays(weekstart,weekend)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; values (@weekstart,@weekend)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; set @weekstart= DATEADD(wk,1,DATEADD(wk,DATEDIFF(wk,0,@weekstart),0))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;print &amp;nbsp;@weekstart&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp;set @weekend=DATEADD(dd,6,@weekstart)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select @day= datepart(dw,@EndDate)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;if @day=6 or @day=7&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;insert into #weekdays(weekstart,weekend)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;values (@weekstart,@weekend)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue; font-family: Verdana, sans-serif;&quot;&gt;select CAST(weekstart AS DATE) as WeekStart, CAST(weekend AS DATE) as WeekEnd from #weekdays&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This script will gives the following result:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;WeekStart &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WeekEnd&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-04-13&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-04-19&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-04-20&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-04-26&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-04-27&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-05-03&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-05-04&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-05-10&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-05-11&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-05-17&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-05-18&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-05-24&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-05-25&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-05-31&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #274e13; font-family: Verdana, sans-serif;&quot;&gt;2015-06-01&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;2015-06-07&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/358199046814274418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/script-to-find-complete-weeks-within.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/358199046814274418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/358199046814274418'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/07/script-to-find-complete-weeks-within.html' title='Script to find the complete weeks within two given dates'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-7522905198839453826</id><published>2015-02-01T11:45:00.000+05:30</published><updated>2015-02-01T11:45:04.231+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Best Practices"/><title type='text'>Importance of Best Practices in database programming</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px; margin-bottom: 0.6em; margin-top: 0.6em; padding: 0px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 12.8000001907349px;&quot;&gt;For any programming language, just writing the code is not well enough. It should be written using the best practices. This article will try to explain the disadvantages of writing code without using Best Practices and latter on how best practices can be implemented in our database code.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Code written without using best practices has the following disadvantages:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1)&amp;nbsp;&lt;strong&gt;Difficult to maintain:-&lt;/strong&gt;&amp;nbsp;If the code is not written properly, it will be very difficult to modify the code in future and sometimes it become so messy that we required to rewrite the code again even for a small change.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2)&amp;nbsp;&lt;strong&gt;Lot of unusable code left which makes the code unnecessary lengthy: -&lt;/strong&gt;&amp;nbsp;If we do not do the designing part correctly, we keep changing the code again and again which result in lot of reworking. Due to this most of the time leads to a situation where some procedure is left with function or block of query which is not required but it keep executing.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;3) Difficult to understand the code: -&amp;nbsp;&lt;/strong&gt;One should write a code which can be easily understandable by the other team members. If we do not write the proper comments for each block of code, it becomes difficult to understand the purpose behind the block of code.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;4)&lt;/strong&gt;&amp;nbsp;&lt;strong&gt;Poor performance due to improper written complex queries: -&lt;/strong&gt;&amp;nbsp;In database, there can be multiple ways to write a query which fetch/update/delete records from the tables but performance depends on how we write the queries. If we do not write the optimized queries, it badly affects the performance of the application.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;5)&lt;/strong&gt;&amp;nbsp;&lt;strong&gt;Unexpected error or behaviors due to poor exceptional handling:-&amp;nbsp;&lt;/strong&gt;If exception handling is not done properly, query execution may break in midway and wrong data is inserted into the tables which will corrupt the database.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;6) Locking of tables for long duration due to poor transaction handling: -&lt;/strong&gt;&amp;nbsp;Transactions should be used so that in case of any exception or error, uncommitted data must be rolled back. But sometimes we use transaction so poorly that it locked the main tables for longer time and it resulted in the deadlock situation and long duration of locking period result in poor application performance.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;7) Difficult to debug: -&lt;/strong&gt;&amp;nbsp;If the code is written in a very messy way with lot of unusable codes, it becomes difficult to debug the code and find the error.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Best practices can be divided into 3 sections&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1) How much time you spend in design phase of the database&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2) How you write the block of code&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;3) How you write the SQL queries&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Time spends on design of the database:-&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Best practices says that the more time you spend on the designing phase , the less time you spend on coding, fixing the bugs and rework. It doesn&#39;t not says that one should spend all the time in the designing phase itself but one should spend 40%-50% time depending on the project complexity on the design phase. This is true for not only database programming but for any other languages too. In any programming, it has said that we should spend more time on designing rather than in code. For example,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;40% of the time was spent on design;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;30% of the time was spent on coding;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;20% of the time was spent on testing;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;10% of the time was spent on documenting.&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;But most of the developers do exactly the opposite. They spend less time on designing and spend most of the time in coding, reworking on the code and bug fixing. Before start writing any code, one should have done the proper homework on the design and a details technical document should be created whichdescribes how we can divide the requirement into small sections like store procedures, functions etc. One should also match that technical document with the requirement document to make sure that it meets most of the requirement.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Best practices for writing code blocks&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;According to best practices, we should write code based on the following below parameters:-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;1) Maintainability: -&lt;/strong&gt;&amp;nbsp;The code should be written in such a way that if we need to add further queries or modify the existing queries, we can easily do this. We do not need to rewritten it again and again for changes in the future.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;2) Reusable components:&lt;/strong&gt;-Instead of writing lengthy stored procedures, we should try to divide it into multiple small stored procedures so that if we need, we can use these small stored procedures as reusable code components. It save lots of time by using the same stored procedure again and again.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;3) Easy to understand:-&lt;/strong&gt;Every code of block should have proper comments which should clearly define the purpose of this block of code so that any other team member or any other new person in your team can easily understand the code.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;4) Proper error handling:-&lt;/strong&gt;Code should be written in such a way that no error should go unchecked. In case of error, catch block should give proper error message. SQL has given the try catch block for error handing. Unchecked error sometimes breaks the code in the midway and corrupt data is inserted in the tables. Try…Catch help in maintaining the integrity of the database.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;strong&gt;5) Proper transaction handling:-&lt;/strong&gt;Transactions should be handled properly in the stored procedure so that in case of error, uncommitted data can be easily rollback. Also transaction should not be applied in such a way that it keeps locking the tables for longer duration as it affects the performance of the application. Instead of applying transaction in the whole stored procedures, multiple transactions can be applied in stored procedures by keeping the related block of code in a single transaction.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Best practices for writing SQL Queries:-&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;1. All tables in the database should have properly defined relationship using primary keys and foreign keys. It helps in maintaining the database integrity and help in increasing the database performance as with each primary key, SQL server automatically created the clustered Indexes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;2. Indexes should be created on the tables as it increases the performance of the SQL Queries. With latest version of SQL Server, we can use Covering Index to include all the columns of the select query in the indexes. But too many indexes can also decreased the performance, as it take cost in maintaining the indexes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;3. Find the indexes which need to be reorganized or rebuild. Indexes are created to increases the performance of the database. But with a period of time, frequent insertion/deletion and updating of data in the tables causes fragmentation which reduces the effect of indexes. We should check fragmentation and accordingly reorganized or rebuild the indexes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;4. Use &quot;set not count on/off&quot; as it will increase the performance of the queries. Unless there is a need to know the number of rows affected by the execution of the query/stored procedure, we should use &quot;set not count on&quot; at the beginning of the code block and &quot;set not count off&quot; at the end of the code block. Calculation of the number of rows affected by the execution of the query/stored procedure add extra cost to the performance.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;5. Try to avoid looping using the Set based approach but if looping is necessary, try to avoid the cursor and replaces it with while loop or using switch statements or Sub Queries. Since till the cursor is not deallocated, memory is occupied by the cursor data and in case of large amount of data, it can decrease the performance of the SQL queries.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;6. Proper use of temporary tables and table variable. Temporary tables and table variables has its own advantages and disadvantages. If the number of rows which are going to stored in the table is small, then table variable is a good option and if the number of records which is going to be stored in the table is large then we should use the temporary tables as we can create indexes on them which helps in increasing the performance&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;7. Use Joins instead of Sub queries. We should use joins instead of sub queries as much as possible because in case of sub queries, SQL Server internally tries to use joins between the record set return by the separate execution of queries.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;8. Intelligent use of Distinct command. Distinct command adds additional cost to the query. So we should use distinct commands only when we need the unique results.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;9. Proper error handling using Try....catch &amp;nbsp;should be done so that execution of the script should not be stop in the midway due to errors and tables data should not get corrupted.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;10. Do not use &quot;Select * from tablename&quot; command when you only needs to select few columns from the table. In the select section of the query, we should mention only those columns whose data we required from query as if &quot;select *&quot; will give the data from all the columns of the table and it will decrease the performance of the query.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;11. Never use &quot;sp_&quot; prefix in your store procedure name. If we use &quot;sp_&quot; prefix in the procedure name then, SQL will first search the stored procedure within the system procedures and then in the user created stored procedures. So it will result in the waste of time in searching.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;13. Use SQL Profiler to monitor the SQL performance. SQL Profiler is the tool provided by the SQL Server. User can use the SQL Profiler to find out the missing indexes or statistics&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;14. Use stored procedure instead of inline Queries in the code. There are lots of benefits if we use stored procedures which includes re-usability, better Security of Database records due to access rights on stored procedures, good performance due to optimal execution plan maintained by SQL server, easy to maintain and many more...,&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;15. If we do not need the unique results, use Union all instead of Union.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Summary:-&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #2a2a2a; font-size: 12.8000001907349px;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif;&quot;&gt;This article tried to show the disadvantages of not following the best practices and how we can reduce our rework by spending proper time on the designing of the database. Also this article gives put lights on the&amp;nbsp;&lt;span style=&quot;font-size: 12.8000001907349px;&quot;&gt;some&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 12.8000001907349px;&quot;&gt;best practices which we can use during coding to make our database code more flexible, reusable , easy to understand and more optimised.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 12.8000001907349px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/7522905198839453826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2015/02/importance-of-best-practices-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/7522905198839453826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/7522905198839453826'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2015/02/importance-of-best-practices-in.html' title='Importance of Best Practices in database programming'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2007575913516513302.post-5126534634345333231</id><published>2015-01-26T19:53:00.000+05:30</published><updated>2015-01-26T19:53:56.285+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Functions"/><title type='text'>RIGHT() function in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;b&gt;Right():-&lt;/b&gt; This function returns the specified number of characters from the Right part of the given character string.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Syntax:-&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;Select RIGHT ( character_expression , integer_expression )&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;For example, the below query will return two characters from the last.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;Select RIGHT(&#39;Vivek&#39;,2)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Verdana,sans-serif;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;u&gt;Result&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;ek&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.dmca.com/Protection/Status.aspx?ID=ec4f9925-5ebb-44d3-8749-27a206bea65f&quot; title=&quot;DMCA&quot;&gt; &lt;img alt=&quot;DMCA.com&quot; src=&quot;http://images.dmca.com/Badges/_dmca_premi_badge_4.png?ID=ec4f9925-5ebb-44d3-8749-27a206bea65f&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vivekjohari.blogspot.com/feeds/5126534634345333231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vivekjohari.blogspot.com/2014/08/right-function-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5126534634345333231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2007575913516513302/posts/default/5126534634345333231'/><link rel='alternate' type='text/html' href='http://vivekjohari.blogspot.com/2014/08/right-function-in-sql-server.html' title='RIGHT() function in SQL Server'/><author><name>Vivek Johari</name><uri>http://www.blogger.com/profile/04282077969126028105</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>