<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SQL Server Journey with SQL Authority &#187; SQL Trigger</title>
	<atom:link href="http://blog.sqlauthority.com/category/sql-trigger/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:51:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.sqlauthority.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/08e35387c05b61340e885b1763a69d9f?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SQL Server Journey with SQL Authority &#187; SQL Trigger</title>
		<link>http://blog.sqlauthority.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.sqlauthority.com/osd.xml" title="SQL Server Journey with SQL Authority" />
	<atom:link rel='hub' href='http://blog.sqlauthority.com/?pushpress=hub'/>
		<item>
		<title>SQL SERVER &#8211; Fix : Error : 17892 Logon failed for login due to trigger execution. Changed database context to &#8216;master&#8217;.</title>
		<link>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/</link>
		<comments>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 01:30:17 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[DAC]]></category>
		<category><![CDATA[sqlcmd]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5722</guid>
		<description><![CDATA[I had previously written two articles about an intriguing observation of triggers online. SQL SERVER – Interesting Observation of Logon Trigger On All Servers SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers &#8211; Solution If you are wondering what made me write yet another article on logon trigger then let me tell [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5722&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I had previously written two articles about an intriguing observation of triggers online.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/" target="_blank">SQL SERVER – Interesting Observation of Logon Trigger On All Servers</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution" target="_blank">SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers &#8211; Solution</a></p>
<p>If you are wondering what made me write yet another article on logon trigger then let me tell you the story behind it. One of my readers encountered a situation where he dropped the database created in the above two articles and he was unable to logon to the system after that.</p>
<p>Let us recreate the scenario first and attempt to solve the problem.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Audit Database */<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:green;">/* Create Audit Table */<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">ServerLogonHistory<br />
</span><span style="color:gray;">(</span><span style="color:black;">SystemUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">DBUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">SPID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">LogonTime DATETIME</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Create Logon Trigger */<br />
</span><span style="color:blue;">CREATE TRIGGER </span><span style="color:black;">Tr_ServerLogon<br />
</span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER </span><span style="color:blue;">FOR </span><span style="color:black;">LOGON<br />
</span><span style="color:blue;">AS<br />
BEGIN<br />
INSERT INTO </span><span style="color:black;">AuditDb.dbo.ServerLogonHistory<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">SYSTEM_USER</span><span style="color:gray;">,</span><span style="color:magenta;">USER</span><span style="color:gray;">,</span><span style="color:#434343;">@@SPID</span><span style="color:gray;">,</span><span style="color:magenta;">GETDATE</span><span style="color:gray;">()<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Dropping Database AuditDB */<br />
/* Please note login to Server again will<br />
Produce Errors */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">AuditDB<br />
GO</span></code>
</p>
<p style="text-align:justify;">After the database is dropped and we try to login again the following error will be displayed.</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Logon failed for login &#8216;SQL\Pinal&#8217; due to trigger execution.<br />
Changed database context to &#8216;master&#8217;.<br />
Changed language setting to us_english. (Microsoft SQL Server, Error: 17892)</span>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/errortrigger.png" alt="" width="555" height="469" /></p>
<p style="text-align:justify;">This error could have been evaded if the Trigger was dropped prior to dropping database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">DROP TRIGGER </span><span style="color:black;">Tr_ServerLogon </span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER<br />
GO</span></code>
</p>
<p style="text-align:justify;">Now, it will not be possible to logon to the database using SQL Server Management Studio. The only way to fix this problem is using DAC. Read more details about DAC  <a href="http://blog.sqlauthority.com/2009/01/09/sql-server-sqlcmd-using-a-dedicated-administrator-connection-to-kill-currently-running-query/" target="_blank">Using a Dedicated Administrator Connection to Kill Currently Running Query</a>. Now let us take a look at the example in our case where I am using windows authentication to logon to the system.</p>
<p style="text-align:justify;">Connect SQL Server using sqlcmd and -A option, which will establish DAC. Running the following command on command prompt will allow you to login once again in the database. I am specifying argument <em><strong>-d master</strong></em> which will directly enable me to logon to master database when DAC is connected.</p>
<p style="text-align:justify;"><strong>C:\Users\Pinal&gt;sqlcmd -S LocalHost -d master -A<br />
1&gt; DROP TRIGGER Tr_ServerLogon ON ALL SERVER<br />
2&gt; GO</strong>
</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlcmddac.png" alt="" width="477" height="333" /></p>
<p style="text-align:justify;">I hope my explanation on logon triggers, DAC, and sqlcmd is clear to everyone. Let me have your thoughts about my present article.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Question, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Trigger, T SQL, Technology Tagged: DAC, sqlcmd <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5722/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5722/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5722/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5722&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/errortrigger.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlcmddac.png" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers &#8211; Solution</title>
		<link>http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution/</link>
		<comments>http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 01:30:14 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Puzzle]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5718</guid>
		<description><![CDATA[Does the title of this post trigger your mind? If you all remember, a few days back I had written an article on my interesting observation regarding logon triggers. I would advise you to first read SQL SERVER – Interesting Observation of Logon Trigger On All Servers before continuing with this article further to have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5718&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Does the title of this post trigger your mind? If you all remember, a few days back I had written an article on my interesting observation regarding logon triggers. I would advise you to first read <strong><a href="http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/" target="_blank">SQL SERVER – Interesting Observation of Logon Trigger On All Servers</a></strong> before continuing with this article further to have a complete idea of the subject.</p>
<p style="text-align:justify;">The question I put forth in my previous article was &#8211; In single login why the trigger fires multiple times; it should be fired only once. I received numerous answers in thread as well as in my MVP private news group. Now, let us discuss the answer for the same.</p>
<p style="text-align:justify;">The answer is – <strong>It happens because multiple SQL Server services are running as well as intellisense is turned on. </strong></p>
<p style="text-align:justify;">Let us verify the above answer.</p>
<p style="text-align:justify;">First, run the following script to create database and logon Audit table.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Audit Database */<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:green;">/* Create Audit Table */<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">ServerLogonHistory<br />
</span><span style="color:gray;">(</span><span style="color:black;">SystemUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">DBUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">SPID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">LogonTime DATETIME</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Create Logon Trigger */<br />
</span><span style="color:blue;">CREATE TRIGGER </span><span style="color:black;">Tr_ServerLogon<br />
</span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER </span><span style="color:blue;">FOR </span><span style="color:black;">LOGON<br />
</span><span style="color:blue;">AS<br />
BEGIN<br />
INSERT INTO </span><span style="color:black;">AuditDb.dbo.ServerLogonHistory<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">SYSTEM_USER</span><span style="color:gray;">,</span><span style="color:magenta;">USER</span><span style="color:gray;">,</span><span style="color:#434343;">@@SPID</span><span style="color:gray;">,</span><span style="color:magenta;">GETDATE</span><span style="color:gray;">()<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO<br />
</span></code>
</p>
<p style="text-align:justify;">After that, disable all the other SQL Server Services as delineated in the image below using SQL Server Configuration Manager.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/disableservices.png" alt="" width="456" height="277" /></p>
<p style="text-align:justify;">Next, try to logon to the system only one more time.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/loginscreen.png" alt="" width="426" height="319" /></p>
<p style="text-align:justify;">Check the audit table again to verify if there is a single entry for single login.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/singlelogin.png" alt="" width="428" height="594" /></p>
<p style="text-align:justify;">I would once again like to thank all of you for active participation and coming up with wonderful suggestions and answers. Let me have your opinion on this observation.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, Readers Contribution, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Trigger, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5718/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5718/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5718&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/26/sql-server-interesting-observation-of-logon-trigger-on-all-servers-solution/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/disableservices.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/loginscreen.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/singlelogin.png" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Interesting Observation of Logon Trigger On All Servers</title>
		<link>http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/</link>
		<comments>http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/#comments</comments>
		<pubDate>Wed, 27 May 2009 01:30:54 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Audit]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5185</guid>
		<description><![CDATA[I was recently working on security auditing for one of my clients. In this project, there was a requirement that all successful logins in the servers should be recorded. The solution for this requirement is a breeze! Just create logon triggers. I created logon trigger on server to catch all successful windows authentication as well [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5185&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I was recently working on security auditing for one of my clients. In this project, there was a requirement that all successful logins in the servers should be recorded. The solution for this requirement is a breeze! Just create logon triggers. I created logon trigger on server to catch all successful windows authentication as well SQL authenticated solutions. When I was done with this project, I made an interesting observation of executing logon trigger multiple times. It was absolutely unexpected for me! As I was logging only once, naturally, I was expecting the entry only once. However, it was doing it multiple times on different threads – indeed an eccentric phenomenon at first sight!</p>
<p style="text-align:justify;">Let us first pore over our example.</p>
<p style="text-align:justify;"><strong>Create database, table and logon trigger</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Create Audit Database */<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">AuditDb<br />
GO<br />
</span><span style="color:green;">/* Create Audit Table */<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">ServerLogonHistory<br />
</span><span style="color:gray;">(</span><span style="color:black;">SystemUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">DBUser </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">512</span><span style="color:gray;">),<br />
</span><span style="color:black;">SPID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">LogonTime DATETIME</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Create Logon Trigger */<br />
</span><span style="color:blue;">CREATE TRIGGER </span><span style="color:black;">Tr_ServerLogon<br />
</span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER </span><span style="color:blue;">FOR </span><span style="color:black;">LOGON<br />
</span><span style="color:blue;">AS<br />
BEGIN<br />
INSERT INTO </span><span style="color:black;">AuditDb.dbo.ServerLogonHistory<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">SYSTEM_USER</span><span style="color:gray;">,</span><span style="color:magenta;">USER</span><span style="color:gray;">,</span><span style="color:#434343;">@@SPID</span><span style="color:gray;">,</span><span style="color:magenta;">GETDATE</span><span style="color:gray;">()<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO </span></code>
</p>
<p style="text-align:justify;"><strong>Login using SQL Authentication and check audit table</strong></p>
<p style="text-align:justify;"><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/logintr3.jpg" alt="" width="500" height="301" /><br />
</strong>
</p>
<p style="text-align:justify;"><strong>Login using Windows Authentication and check audit table</strong></p>
<p style="text-align:justify;"><strong><img class="alignnone" src="http://www.pinaldave.com/bimg/logintr1.jpg" alt="" width="500" height="538" /></strong></p>
<p style="text-align:justify;">The above example clearly demonstrates that there are multiple entries in the Audit table. Also, on close observation it is evident that there are multiple process IDs as well. Based on these two observations I can come to one conclusion. Similar actions like login to the server took place multiple times.</p>
<p style="text-align:justify;"><strong>Question to readers:</strong></p>
<p style="text-align:justify;"><strong>Have you ever experienced this kind of situation? If yes, then have you received similar entries?</strong></p>
<p style="text-align:justify;">For those, who have not experienced this phenomenon yet, they can recreate this situation very quickly by running the above script, and then you all can post your observations and conclusions here.</p>
<p style="text-align:justify;">I am very much interested in learning the cause that triggers <strong>multiple entries</strong>. Valid suggestions and explanations will be published on this blog with due credit.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<table style="border-collapse:collapse;height:19px;text-align:justify;" border="0" cellspacing="0" cellpadding="0" width="6">
<col style="width:238pt;" width="317"></col>
<tbody>
<tr style="height:12.75pt;">
<td style="height:12.75pt;width:238pt;" width="317" height="17"></td>
</tr>
</tbody>
</table>
<p style="text-align:justify;"><strong> </strong></p>
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Trigger, T SQL, Technology Tagged: SQL Audit <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5185/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5185/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5185/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5185&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/27/sql-server-interesting-observation-of-logon-trigger-on-all-servers/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/logintr3.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/logintr1.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Guidelines and Coding Standards Complete List Download</title>
		<link>http://blog.sqlauthority.com/2008/09/25/sql-server-guidelines-and-coding-standards/</link>
		<comments>http://blog.sqlauthority.com/2008/09/25/sql-server-guidelines-and-coding-standards/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 01:30:54 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQLAuthority]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1143</guid>
		<description><![CDATA[SQL SERVER &#8211; Guidelines and Coding Standards complete List Download Coding standards and guidelines are very important for any developer on the path of successful career. A coding standard is a set of guidelines, rules and regulations on how to write code. Coding standards should be flexible enough or should take care of the situation [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=1143&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:justify;"><a href="http://www.pinaldave.com/best-sql-server-download.cfm?download=SQL-SERVER-Database-Coding-Standards-and-Guidelines-Complete-List-Download"><strong>SQL SERVER &#8211; Guidelines and Coding Standards complete List Download</strong></a></h2>
<p style="text-align:justify;">Coding standards and guidelines are very important for any developer on the path of successful career. A coding standard is a set of guidelines, rules and regulations on how to write code. Coding standards should be flexible enough or should take care of the situation where they should not prevent best practices for coding. They are basically the guidelines that one should follow for better understanding.</p>
<p style="text-align:justify;">The concept behind implementing coding standards and guidelines, is that the consistency and uniformity in programming so that if multiple people are working on the same code, it becomes easier to communicate, share with or understand each other’s work.</p>
<p style="text-align:justify;">With the goal of promoting good coding standards and guidelines I have created document which can guide developers.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/23/sql-server-coding-standards-guidelines-part-1/" target="_blank"><strong>SQL SERVER &#8211; Guidelines and Coding Standards Part &#8211; 1</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/24/sql-server-coding-standards-guidelines-part-2/" target="_blank"><strong>SQL SERVER &#8211; Guidelines and Coding Standards Part &#8211; 2</strong></a></p>
<h2 style="text-align:justify;"><a href="http://www.pinaldave.com/best-sql-server-download.cfm?download=SQL-SERVER-Database-Coding-Standards-and-Guidelines-Complete-List-Download"><strong>SQL SERVER &#8211; Guidelines and Coding Standards complete List Download</strong></a></h2>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Posted in Best Practices, Data Warehousing, Database, DBA, Pinal Dave, SQL, SQL Authority, SQL Coding Standards, SQL Constraint and Keys, SQL Cursor, SQL Data Storage, SQL Documentation, SQL Download, SQL Function, SQL Index, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, SQL Trigger, SQL Utility, SQLAuthority, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/1143/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/1143/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/1143/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=1143&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/09/25/sql-server-guidelines-and-coding-standards/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers Complete List Download</title>
		<link>http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/</link>
		<comments>http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 01:30:39 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL DateTime]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBCC]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQL XML]]></category>
		<category><![CDATA[SQLAuthority]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1134</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters Download SQL Server 2008 Interview Questions and Answers Complete List UPDATE: This article series has been updated with new interview questions and answers series. Interview is very important event for any person. A good interview leads to good career if candidate [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=1134&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h2 style="text-align:justify;"><a href="http://blog.sqlauthority.com/sql-server-interview-questions-and-answers/"><strong>Download SQL Server 2008 Interview Questions and Answers Complete List</strong></a></h2>
<p style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE:</strong></span> <a href="http://blog.sqlauthority.com/sql-server-interview-questions-and-answers/">This article series has been updated with new interview questions and answers series.</a></p>
<p style="text-align:justify;">Interview is very important event for any person. A good interview leads to good career if candidate is willing to learn. I always enjoy interview questions and answers series. This is my very humble attempt to write SQL Server 2008 interview questions and answers. SQL Server is very large subject and not everything is usually asked in interview. In interview what matters the most is <strong>conceptual knowledge</strong> and <strong>learning attitude</strong>.</p>
<p style="text-align:justify;">I have listed all the series in this post so that it can be easily downloaded and used. All the questions are collected and listed in one PDF which is here to download. If you have any question or if you want to add to any of the question please send me mail or write a comment.</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/12/sql-server-2008-interview-questions-and-answers-part-1/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 1</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/13/sql-server-2008-interview-questions-and-answers-part-2/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 2</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/14/sql-server-2008-interview-questions-and-answers-part-3/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 3</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/15/sql-server-2008-interview-questions-and-answers-part-4/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 4</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/16/sql-server-2008-interview-questions-and-answers-part-5/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 5</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/17/sql-server-2008-interview-questions-and-answers-part-6/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 6</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/18/sql-server-2008-interview-questions-and-answers-part-7/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 7</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/09/19/sql-server-2008-interview-questions-and-answers-part-8/"><strong>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 8</strong></a></p>
<h2 style="text-align:justify;"><a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/"><strong>Download SQL Server 2008 Interview Questions and Answers Complete List</strong></a></h2>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Posted in Database, Pinal Dave, SQL, SQL Authority, SQL Constraint and Keys, SQL Cursor, SQL Data Storage, SQL DateTime, SQL Documentation, SQL Download, SQL Error Messages, SQL Function, SQL Index, SQL Interview Questions and Answers, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Server DBCC, SQL Stored Procedure, SQL Tips and Tricks, SQL Trigger, SQL Utility, SQL XML, SQLAuthority, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/1134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/1134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/1134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=1134&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/feed/</wfw:commentRss>
		<slash:comments>141</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers &#8211; Part 1</title>
		<link>http://blog.sqlauthority.com/2008/09/12/sql-server-2008-interview-questions-and-answers-part-1/</link>
		<comments>http://blog.sqlauthority.com/2008/09/12/sql-server-2008-interview-questions-and-answers-part-1/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 01:30:07 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQLAuthority]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=980</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers Complete List Download 1) General Questions of SQL SERVER What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=980&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h2 style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL SERVER &#8211; 2008 &#8211; Interview Questions and Answers Complete List Download</a></strong></h2>
<p style="text-align:justify;"><strong>1) </strong><strong>General Questions of SQL SERVER </strong></p>
<p style="text-align:justify;"><strong>What is RDBMS?</strong></p>
<p style="text-align:justify;">Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage. (<a href="http://blog.sqlauthority.com/2008/06/27/sql-server-difference-between-dbms-and-rdbms/" target="_blank">Read More Here</a>)</p>
<p style="text-align:justify;"><strong>What are the properties of the Relational tables?</strong></p>
<p style="text-align:justify;">Relational tables have six properties:</p>
<ul class="unIndentedList" style="text-align:justify;">
<li> Values are atomic.</li>
<li> Column values are of the same kind.</li>
<li> Each row is unique.</li>
<li> The sequence of columns is insignificant.</li>
<li> The sequence of rows is insignificant.</li>
<li> Each column must have a unique name.</li>
</ul>
<p style="text-align:justify;"><strong>What is Normalization?</strong></p>
<p style="text-align:justify;">Database normalization is a data design and organization process applied to data structures based on rules that help building relational databases. In relational database design, the process of organizing data to minimize redundancy is called normalization. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.</p>
<p style="text-align:justify;"><strong>What are different normalization forms?</strong></p>
<p style="text-align:justify;"><strong><em>1NF: Eliminate Repeating Groups</em></strong></p>
<p style="text-align:justify;">Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.</p>
<p style="text-align:justify;"><strong><em>2NF: Eliminate Redundant Data</em></strong></p>
<p style="text-align:justify;">If an attribute depends on only part of a multi-valued key, remove it to a separate table.</p>
<p style="text-align:justify;"><strong><em>3NF: Eliminate Columns Not Dependent On Key</em></strong></p>
<p style="text-align:justify;">If attributes do not contribute to a description of the key, remove them to a separate table. All attributes must be directly dependent on the primary key. (<a href="http://blog.sqlauthority.com/2007/11/26/sql-server-rules-of-third-normal-form-and-normalization-advantage-3nf/" target="_blank">Read More Here</a>)</p>
<p style="text-align:justify;"><strong><em>BCNF: Boyce-Codd Normal Form</em></strong></p>
<p style="text-align:justify;">If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.</p>
<p style="text-align:justify;"><strong><em>4NF: Isolate Independent Multiple Relationships</em></strong></p>
<p style="text-align:justify;">No table may contain two or more 1:n or n:m relationships that are not directly related.</p>
<p style="text-align:justify;"><strong><em>5NF: Isolate Semantically Related Multiple Relationships</em></strong></p>
<p style="text-align:justify;">There may be practical constrains on information that justify separating logically related many-to-many relationships.</p>
<p style="text-align:justify;"><strong><em>ONF: Optimal Normal Form</em></strong></p>
<p style="text-align:justify;">A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.</p>
<p style="text-align:justify;"><strong><em>DKNF: Domain-Key Normal Form</em></strong></p>
<p style="text-align:justify;">A model free from all modification anomalies is said to be in DKNF.</p>
<p style="text-align:justify;">Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.</p>
<p style="text-align:justify;"><strong>What is De-normalization?</strong></p>
<p style="text-align:justify;">De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.</p>
<p style="text-align:justify;"><strong>What is Stored Procedure?</strong></p>
<p style="text-align:justify;">A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.</p>
<p style="text-align:justify;">e.g.  <code style="font-size:12px;"><span style="color:darkred;">sp_helpdb</span></code>, <code style="font-size:12px;"><span style="color:darkred;">sp_renamedb</span></code>, <code style="font-size:12px;"><span style="color:darkred;">sp_depends</span></code> etc.</p>
<p style="text-align:justify;"><strong>What is Trigger?</strong></p>
<p style="text-align:justify;">A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.</p>
<p style="text-align:justify;"><em>Nested Trigger</em>: A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger. (<a href="http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/" target="_blank">Read More Here</a>)</p>
<p style="text-align:justify;"><strong>What is View?</strong></p>
<p style="text-align:justify;">A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table. The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.</p>
<p style="text-align:justify;"><strong>What is Index?</strong></p>
<p style="text-align:justify;">An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes; they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.</p>
<p style="text-align:justify;"><strong>What is a Linked Server?</strong></p>
<p style="text-align:justify;">Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data. Stored Procedure <code style="font-size:12px;"><span style="color:darkred;">sp_addlinkedserver</span></code>, <code style="font-size:12px;"><span style="color:darkred;">sp_addlinkedsrvlogin</span></code> will be used add new Linked Server. (<a href="http://blog.sqlauthority.com/2007/10/06/sql-server-executing-remote-stored-procedure-calling-stored-procedure-on-linked-server/" target="_blank">Read More Here</a>)</p>
<p style="text-align:justify;">© Copyright 2000-2009<a title="Pinal Dave" href="http://www.pinaldave.com/" target="_blank"> Pinal Dave.</a> All Rights Reserved. <a href="http://blog.sqlauthority.com/" target="_blank">SQLAuthority.com</a></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/980/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/980/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/980/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/980/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/980/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=980&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/09/12/sql-server-2008-interview-questions-and-answers-part-1/feed/</wfw:commentRss>
		<slash:comments>208</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Disable All the Trigger of Current Database</title>
		<link>http://blog.sqlauthority.com/2008/08/19/sql-server-disable-all-the-trigger-of-current-database/</link>
		<comments>http://blog.sqlauthority.com/2008/08/19/sql-server-disable-all-the-trigger-of-current-database/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 01:30:48 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=854</guid>
		<description><![CDATA[I have previously written article about SQL SERVER &#8211; Disable All Triggers on a Database &#8211; Disable All Triggers on All Servers. This is alternate method to achieve the same task. Following article is sent by Manish Kaushik. I recommend all of you to read original article along with this article for complete idea. CREATE PROCEDURE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=854&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I have previously written article about <strong><a href="http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/" target="_blank">SQL SERVER &#8211; Disable All Triggers on a Database &#8211; Disable All Triggers on All Servers</a></strong>. This is alternate method to achieve the same task.</p>
<p style="text-align:justify;">Following article is sent by <a href="http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/#comment-41749" target="_blank">Manish Kaushik</a>. I recommend all of you to read original article along with this article for complete idea.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">[dbo].[DisableAllTriggers]<br />
</span><span style="color:blue;">AS<br />
DECLARE </span><span style="color:#434343;">@string </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">8000</span><span style="color:gray;">)<br />
</span><span style="color:blue;">DECLARE </span><span style="color:#434343;">@tableName </span><span style="color:blue;">NVARCHAR</span><span style="color:gray;">(</span><span style="color:black;">500</span><span style="color:gray;">)<br />
</span><span style="color:blue;">DECLARE </span><span style="color:black;">cur </span><span style="color:blue;">CURSOR<br />
FOR SELECT </span><span style="color:black;">name </span><span style="color:blue;">AS </span><span style="color:black;">tbname </span><span style="color:blue;">FROM </span><span style="color:black;">sysobjects </span><span style="color:blue;">WHERE </span><span style="color:black;">id </span><span style="color:blue;">IN</span><span style="color:gray;">(</span><span style="color:blue;">SELECT </span><span style="color:black;">parent_obj </span><span style="color:blue;">FROM </span><span style="color:black;">sysobjects </span><span style="color:blue;">WHERE </span><span style="color:black;">xtype</span><span style="color:blue;">=</span><span style="color:red;">'tr'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">OPEN </span><span style="color:black;">cur<br />
</span><span style="color:blue;">FETCH </span><span style="color:black;">next </span><span style="color:blue;">FROM </span><span style="color:black;">cur </span><span style="color:blue;">INTO </span><span style="color:#434343;">@tableName<br />
</span><span style="color:blue;">WHILE </span><span style="color:#434343;">@@fetch_status </span><span style="color:blue;">= </span><span style="color:black;">0<br />
</span><span style="color:blue;">BEGIN<br />
SET </span><span style="color:#434343;">@string </span><span style="color:blue;">=</span><span style="color:red;">'Alter table '</span><span style="color:gray;">+ </span><span style="color:#434343;">@tableName </span><span style="color:gray;">+ </span><span style="color:red;">' Disable trigger all'<br />
</span><span style="color:blue;">EXEC </span><span style="color:gray;">(</span><span style="color:#434343;">@string</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FETCH </span><span style="color:black;">next </span><span style="color:blue;">FROM </span><span style="color:black;">cur </span><span style="color:blue;">INTO </span><span style="color:#434343;">@tableName<br />
</span><span style="color:blue;">END<br />
CLOSE </span><span style="color:black;">cur<br />
</span><span style="color:blue;">DEALLOCATE </span><span style="color:black;">cur<br />
GO<br />
</span><span style="color:green;">----To execute the SP</span></code>
</p>
<p style="text-align:justify;"><span style="color:blue;">EXEC </span><span style="color:black;">[DisableAllTriggers]</span></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/854/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/854/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/854/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/854/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/854/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=854&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/08/19/sql-server-disable-all-the-trigger-of-current-database/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQLAuthority News &#8211; Best Articles on SQLAuthority.com</title>
		<link>http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/</link>
		<comments>http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 14:00:25 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL DateTime]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Humor]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBCC]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/</guid>
		<description><![CDATA[SQL SERVER &#8211; Cursor to Kill All Process in Database SQL SERVER &#8211; Find Stored Procedure Related to Table in Database &#8211; Search in All Stored procedure SQL SERVER &#8211; Shrinking Truncate Log File &#8211; Log Full SQL SERVER &#8211; Simple Example of Cursor SQL SERVER &#8211; UDF &#8211; Function to Convert Text String to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=395&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2006/12/01/sql-server-cursor-to-kill-all-process-in-database/">SQL SERVER &#8211; Cursor to Kill All Process in Database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2006/12/10/sql-server-find-stored-procedure-related-to-table-in-database-search-in-all-stored-procedure/">SQL SERVER &#8211; Find Stored Procedure Related to Table in Database &#8211; Search in All Stored procedure</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2006/12/30/sql-server-shrinking-truncate-log-file-log-full/">SQL SERVER &#8211; Shrinking Truncate Log File &#8211; Log Full</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/01/01/sql-server-simple-example-of-cursor/">SQL SERVER &#8211; Simple Example of Cursor</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/02/01/sql-server-udf-function-to-convert-text-string-to-title-case-proper-case/">SQL SERVER &#8211; UDF &#8211; Function to Convert Text String to Title Case &#8211; Proper Case</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/02/25/sql-server-restore-database-backup-using-sql-script-t-sql/">SQL SERVER &#8211; Restore Database Backup using SQL Script (T-SQL)</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/02/28/sql-server-t-sql-script-to-find-the-cd-key-from-registry/">SQL SERVER &#8211; T-SQL Script to find the CD key from Registry</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/01/sql-server-delete-duplicate-records-rows/">SQL SERVER &#8211; Delete Duplicate Records &#8211; Rows</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/05/sql-server-quoted_identifier-onoff-and-ansi_null-onoff-explanation/">SQL SERVER &#8211; QUOTED_IDENTIFIER ON/OFF and ANSI_NULL ON/OFF Explanation</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/10/sql-server-union-vs-union-all-which-is-better-for-performance/">SQL SERVER &#8211; Union vs. Union All &#8211; Which is better for performance?</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/15/sql-server-dbcc-reseed-table-identity-value-reset-table-identity/">SQL SERVER &#8211; DBCC RESEED Table Identity Value &#8211; Reset Table Identity</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/">SQL SERVER &#8211; @@IDENTITY vs SCOPE_IDENTITY() vs IDENT_CURRENT &#8211; Retrieve Last Inserted Identity of Record</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/29/sql-server-difference-between-distinct-and-group-by-distinct-vs-group-by/">SQL SERVER &#8211; Difference between DISTINCT and GROUP BY &#8211; Distinct vs Group By</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/03/30/sql-server-index-seek-vs-index-scan-table-scan/">SQL SERVER &#8211; Index Seek Vs. Index Scan (Table Scan)</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/01/sql-server-tempdb-is-full-move-tempdb-from-one-drive-to-another-drive/">SQL SERVER &#8211; TempDB is Full. Move TempDB from one drive to another drive</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/03/sql-server-t-sql-paging-query-technique-comparison-sql-2000-vs-sql-2005/">SQL SERVER &#8211; T-SQL Paging Query Technique Comparison &#8211; SQL 2000 vs SQL 2005</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/05/sql-server-performance-optimization-of-sql-query-and-filegroups/">SQL SERVER &#8211; Performance Optimization of SQL Query and FileGroups</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/08/sql-server-search-text-field-charindex-vs-patindex/">SQL SERVER &#8211; Search Text Field &#8211; CHARINDEX vs PATINDEX</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/11/sql-server-2005-explanation-of-trycatch-and-error-handling/">SQL SERVER &#8211; 2005 Explanation of TRY…CATCH and ERROR Handling</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/13/sql-server-script-to-find-sql-server-on-network/">SQL SERVER &#8211; Script to find SQL Server on Network</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/13/sql-server-stored-procedures-advantages-and-best-advantage/">SQL SERVER &#8211; Stored Procedures Advantages and Best Advantage</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/14/sql-server-case-statementexpression-examples-and-explanation/">SQL SERVER &#8211; CASE Statement/Expression Examples and Explanation</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/22/sql-server-raid-configuration-raid-10/">SQL SERVER &#8211; Raid Configuration &#8211; RAID 10</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/23/sql-server-understanding-new-index-type-of-sql-server-2005-included-column-index-along-with-clustered-index-and-non-clustered-index/">SQL SERVER &#8211; Understanding new Index Type of SQL Server 2005 Included Column Index along with Clustered Index and Non-clustered Index</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/23/sql-server-query-to-find-seed-values-increment-values-and-current-identity-column-value-of-the-table/">SQL SERVER &#8211; Query to Find Seed Values, Increment Values and Current Identity Column value of the table</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/24/sql-server-six-properties-of-relational-tables/">SQL SERVER &#8211; Six Properties of Relational Tables</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/24/sql-server-trim-function-udf-trim/">SQL SERVER &#8211; TRIM() Function &#8211; UDF TRIM()</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/26/sql-server-difference-between-unique-index-vs-unique-constraint/">SQL SERVER &#8211; Difference between Unique Index vs Unique Constraint</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/27/sql-server-2005-locking-hints-and-examples/">SQL SERVER &#8211; 2005 Locking Hints and Examples</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/28/sql-server-good-better-and-best-programming-techniques/">SQL SERVER &#8211; Good, Better and Best Programming Techniques</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/29/sql-server-random-number-generator-script-sql-query/">SQL SERVER &#8211; Random Number Generator Script &#8211; SQL Query</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/02/sql-server-2005-top-improvementsenhancements/">SQL SERVER &#8211; 2005 TOP Improvements/Enhancements</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/07/sql-server-20052000-examples-and-explanation-for-goto/">SQL SERVER &#8211; 2005/2000 Examples and Explanation for GOTO</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/11/sql-server-explanation-sql-command-go/">SQL SERVER &#8211; Explanation SQL Commando GO</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/12/sql-server-2005-list-all-the-database/">SQL SERVER &#8211; 2005 &#8211; List all the database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/13/sql-server-udf-function-to-parse-alphanumeric-characters-from-string/">SQL SERVER &#8211; UDF &#8211; Function to Parse AlphaNumeric Characters from String</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/17/sql-server-disable-index-enable-index-alter-index/">SQL SERVER &#8211; Disable Index &#8211; Enable Index &#8211; ALTER Index</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/18/sql-server-2005-ssms-change-t-sql-batch-separator/">SQL SERVER &#8211; 2005 &#8211; SSMS Change T-SQL Batch Separator</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/20/sql-server-sql-code-formatter-tools/">SQL SERVER &#8211; SQL Code Formatter Tools</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/22/sql-server-2005-comparison-except-operator-vs-not-in/">SQL SERVER &#8211; 2005 Comparison EXCEPT operator vs. NOT IN</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/23/sql-server-2005-northwind-database-or-adventureworks-database-samples-databases/">SQL SERVER &#8211; 2005 NorthWind Database or AdventureWorks Database &#8211; Samples Databases</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/26/sql-server-2005-find-table-without-clustered-index-find-table-with-no-primary-key/">SQL SERVER &#8211; 2005 Find Table without Clustered Index &#8211; Find Table with no Primary Key</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/27/sql-server-2005-limiting-result-sets-by-using-tablesample-examples/">SQL SERVER &#8211; 2005 Limiting Result Sets by Using TABLESAMPLE &#8211; Examples</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/29/sql-server-2005-change-database-compatible-level-backward-compatibility/">SQL SERVER &#8211; 2005 Change Database Compatible Level &#8211; Backward Compatibility</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/01/sql-server-2005-constraint-on-varcharmax-field-to-limit-it-certain-length/">SQL SERVER &#8211; 2005 Constraint on VARCHAR(MAX) Field To Limit It Certain Length</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/08/sql-server-insert-multiple-records-using-one-insert-statement-use-of-union-all/">SQL SERVER &#8211; Insert Multiple Records Using One Insert Statement &#8211; Use of UNION ALL</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/10/sql-server-retrieve-select-only-date-part-from-datetime-best-practice/">SQL SERVER &#8211; Retrieve &#8211; Select Only Date Part From DateTime &#8211; Best Practice</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/11/sql-server-2005-t-sql-paging-query-technique-comparison-over-and-row_number-cte-vs-derived-table/">SQL SERVER &#8211; 2005 T-SQL Paging Query Technique Comparison (OVER and ROW_NUMBER()) &#8211; CTE vs. Derived Table</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/14/sql-server-easy-sequence-of-select-from-join-where-group-by-having-order-by/">SQL SERVER &#8211; Easy Sequence of SELECT FROM JOIN WHERE GROUP BY HAVING ORDER BY</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/">SQL SERVER &#8211; 2005 &#8211; UDF &#8211; User Defined Function to Strip HTML &#8211; Parse HTML &#8211; No Regular Expression</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/21/sql-server-retrieve-current-date-time-in-sql-server-current_timestamp-getdate-fn-now/">SQL SERVER &#8211; Retrieve Current Date Time in SQL Server CURRENT_TIMESTAMP, GETDATE(), {fn NOW()}</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/22/sql-server-explanation-and-comparison-of-nullif-and-isnull/">SQL SERVER &#8211; Explanation and Comparison of NULLIF and ISNULL</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/23/sql-server-2005-row-overflow-data-explanation/">SQL SERVER &#8211; 2005 Row Overflow Data Explanation</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/24/sql-server-comparison-index-fragmentation-index-de-fragmentation-index-rebuild-sql-server-2000-and-sql-server-2005/">SQL SERVER &#8211; Comparison Index Fragmentation, Index De-Fragmentation, Index Rebuild &#8211; SQL SERVER 2000 and SQL SERVER 2005</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/03/sql-server-comparison-similarity-and-difference-temptable-vs-tempvariable/">SQL SERVER &#8211; Comparison : Similarity and Difference #TempTable vs @TempVariable</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/04/sql-server-definition-comparison-and-difference-between-having-and-where-clause/">SQL SERVER &#8211; Definition, Comparison and Difference between HAVING and WHERE Clause</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/05/sql-server-2005-best-practices-analyzer-tutorial-sample-example/">SQL SERVER &#8211; 2005 Best Practices Analyzer Tutorial &#8211; Sample Example</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/10/sql-server-2005-list-all-stored-procedure-modified-in-last-n-days/">SQL SERVER &#8211; 2005 &#8211; List All Stored Procedure Modified in Last N Days</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/11/sql-server-count-duplicate-records-rows/">SQL SERVER &#8211; Count Duplicate Records &#8211; Rows</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/17/sql-server-case-statement-in-order-by-clause-order-by-using-variable/">SQL SERVER &#8211; CASE Statement in ORDER BY Clause &#8211; ORDER BY using Variable</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/18/sql-server-restore-database-without-or-with-backup-everything-about-restore-and-backup/">SQL SERVER &#8211; Restore Database Without or With Backup &#8211; Everything About Restore and Backup</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/23/sql-server-udf-function-to-get-previous-and-next-work-day-exclude-saturday-and-sunday/">SQL SERVER &#8211; UDF &#8211; Function to Get Previous And Next Work Day &#8211; Exclude Saturday and Sunday</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/04/sql-server-one-thing-all-dba-must-know/">SQL SERVER &#8211; One Thing All DBA Must Know</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/07/sql-server-2005-list-tables-in-database-without-primary-key/">SQL SERVER &#8211; 2005 &#8211; List Tables in Database Without Primary Key</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/10/sql-server-2005-find-stored-procedure-create-date-and-modified-date/">SQL SERVER &#8211; 2005 &#8211; Find Stored Procedure Create Date and Modified Date</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/11/sql-server-udf-validate-integer-function/">SQL SERVER &#8211; UDF &#8211; Validate Integer Function</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/14/sql-server-what-is-sql-how-to-pronounce-sql/">SQL SERVER &#8211; What is SQL? How to pronounce SQL?</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/16/sql-server-2005-difference-and-similarity-between-newsequentialid-and-newid/">SQL SERVER &#8211; 2005 &#8211; Difference and Similarity Between NEWSEQUENTIALID() and NEWID()</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/17/sql-server-2005-explanation-and-script-for-online-index-operations-create-rebuild-drop/">SQL SERVER &#8211; 2005 &#8211; Explanation and Script for Online Index Operations &#8211; Create, Rebuild, Drop</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/18/sql-server-find-last-day-of-any-month-current-previous-next/">SQL SERVER &#8211; Find Last Day of Any Month &#8211; Current Previous Next</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/22/sql-server-t-sql-script-to-insert-carriage-return-and-new-line-feed-in-code/">SQL SERVER &#8211; T-SQL Script to Insert Carriage Return and New Line Feed in Code</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/24/sql-server-2005-t-sql-script-to-attach-and-detach-database/">SQL SERVER &#8211; 2005 &#8211; T-SQL Script to Attach and Detach Database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/08/28/sql-server-actual-execution-plan-vs-estimated-execution-plan/">SQL SERVER &#8211; Actual Execution Plan vs. Estimated Execution Plan</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/03/sql-server-2005-search-stored-procedure-code-search-stored-procedure-text/">SQL SERVER &#8211; 2005 &#8211; Search Stored Procedure Code &#8211; Search Stored Procedure Text</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/04/sql-server-2005-find-tables-with-foreign-key-constraint-in-database/">SQL SERVER &#8211; 2005 &#8211; Find Tables With Foreign Key Constraint in Database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/04/sql-server-2005-find-tables-with-primary-key-constraint-in-database/">SQL SERVER &#8211; 2005 &#8211; Find Tables With Primary Key Constraint in Database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/06/sql-server-2005-introduction-and-explanation-to-sqlcmd/">SQL SERVER &#8211; 2005 &#8211; Introduction and Explanation to sqlcmd</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/08/sql-server-udf-user-defined-function-get-number-of-days-in-month/">SQL SERVER &#8211; UDF &#8211; User Defined Function &#8211; Get Number of Days in Month</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/09/sql-server-2005-start-stop-restart-sql-server-from-command-prompt/">SQL SERVER &#8211; 2005 &#8211; Start Stop Restart SQL Server From Command Prompt</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/16/sql-server-2005-list-all-the-constraint-of-database-find-primary-key-and-foreign-key-constraint-in-database/">SQL SERVER &#8211; 2005 &#8211; List All The Constraint of Database &#8211; Find Primary Key and Foreign Key Constraint in Database</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/18/sql-server-udf-validate-positive-integer-function-validate-natural-integer-function/">SQL SERVER &#8211; UDF &#8211; Validate Positive Integer Function &#8211; Validate Natural Integer Function</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/09/25/sql-server-effect-of-transaction-on-local-variable-after-rollback-and-after-commit/">SQL SERVER &#8211; Effect of TRANSACTION on Local Variable &#8211; After ROLLBACK and After COMMIT</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/">SQL SERVER &#8211; 2005 &#8211; OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/10/09/sql-server-2005-sample-example-of-ranking-functions-row_number-rank-dense_rank-ntile/">SQL SERVER &#8211; 2005 &#8211; Sample Example of RANKING Functions &#8211; ROW_NUMBER, RANK, DENSE_RANK, NTILE</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/10/16/sql-server-three-t-sql-script-to-create-primary-keys-on-table/">SQL SERVER &#8211; Three T-SQL Script to Create Primary Keys on Table</a></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/395/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/395/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/395/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/395/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/395/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=395&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Disable All Triggers on a Database &#8211; Disable All Triggers on All Servers</title>
		<link>http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/</link>
		<comments>http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/#comments</comments>
		<pubDate>Mon, 29 Oct 2007 14:00:25 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/</guid>
		<description><![CDATA[Just a day ago, I received question in email regarding my article SQL SERVER &#8211; 2005 Disable Triggers &#8211; Drop Triggers. Question : How to disable all the triggers for database? Additionally, how to disable all the triggers for all servers? Answer: Disable all the triggers for a single database: USE AdventureWorks; GO DISABLE TRIGGER [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=389&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Just a day ago, I received question in email regarding my article <a href="http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/" target="_blank">SQL SERVER &#8211; 2005 Disable Triggers &#8211; Drop Triggers</a>.</p>
<p style="text-align:justify;"><strong>Question : How to disable all the triggers for database? Additionally, how to disable all the triggers for all servers?</strong><br />
<strong>Answer:</strong><br />
<em><strong>Disable all the triggers for a single database:</strong></em><br />
<code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
DISABLE </span><span style="color:blue;">TRIGGER </span><span style="color:black;">Person.uAddress </span><span style="color:blue;">ON </span><span style="color:black;">AdventureWorks</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;"><em><strong>Disable all the triggers for all servers:</strong></em><br />
<code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
DISABLE </span><span style="color:blue;">TRIGGER </span><span style="color:gray;">ALL </span><span style="color:blue;">ON </span><span style="color:gray;">ALL </span><span style="color:black;">SERVER</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO </span></code>
</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong>, <a href="http://msdn2.microsoft.com/en-us/library/ms189748.aspx" target="_blank">BOL-Triggers</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/389/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/389/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/389/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=389&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/10/29/sql-server-disable-all-triggers-on-a-database-disable-all-triggers-on-all-servers/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2005 &#8211; Create Script to Copy Database Schema and All The Objects &#8211; Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects</title>
		<link>http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/</link>
		<comments>http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 14:00:39 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/</guid>
		<description><![CDATA[Update: This article is re-written with SQL Server 2008 R2 instance over here: SQL SERVER – 2008 – 2008 R2 – Create Script to Copy Database Schema and All The Objects – Data, Schema, Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects Following quick tutorial demonstrates how to create T-SQL script [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=302&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><strong><span style="color:#ff0000;">Update:</span> This article is re-written with SQL Server 2008 R2 instance over here: <a href="http://blog.sqlauthority.com/2011/05/07/sql-server-2008-2008-r2-create-script-to-copy-database-schema-and-all-the-objects-data-schema-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/">SQL SERVER – 2008 – 2008 R2 – Create Script to Copy Database Schema and All The Objects – Data, Schema, Stored Procedure, Functions, Triggers, Tables, Views, Constraints and All Other Database Objects</a></strong></p>
<p style="text-align:justify;">Following quick tutorial demonstrates how to create T-SQL script to copy complete database schema and all of its objects such as Stored Procedure, Functions, Triggers, Tables, Views, Constraints etc. You can review your schema, backup for reference or use it to compare with previous backup.</p>
<p style="text-align:justify;"><strong>Step 1 : Start </strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy1.gif" alt="" /></p>
<p style="text-align:justify;"><strong>Step 2 : Welcome Screen<br />
</strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy2.gif" alt="" width="493" height="449" /></p>
<p style="text-align:justify;"><strong>Step 3 : Select One or Multiple Database</strong><br />
If Script all objects in the selected database checkbox is not selected it will give options to selected individual objects on respective screen. (e.g. Stored Procedure, Triggers and all other object will have their own screen where they can be selected)</p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy3.gif" alt="" width="493" height="449" /></p>
<p style="text-align:justify;"><strong>Step 4 : Select database options</strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy4.gif" alt="" width="493" height="449" /></p>
<p style="text-align:justify;"><strong>Step 5 : Select output option</strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy5.gif" alt="" width="493" height="449" /></p>
<p style="text-align:justify;"><strong>Step 6 : Review Summary</strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy6.gif" alt="" /></p>
<p style="text-align:justify;"><strong>Step 7 : Observe script generation process </strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy7.gif" alt="" width="493" height="449" /></p>
<p style="text-align:justify;"><strong>Step 8 : Database object script generation completed in new query window</strong></p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/bimg/databasecopy8.gif" alt="" /></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong>, All images are protected by copyright owner SQLAuthority.com</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/302/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/302/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/302/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=302&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/08/21/sql-server-2005-create-script-to-copy-database-schema-and-all-the-objects-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/feed/</wfw:commentRss>
		<slash:comments>632</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/databasecopy1.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy2.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy3.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy4.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy5.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy6.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy7.gif" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/databasecopy8.gif" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; 2005 &#8211; Server and Database Level DDL Triggers Examples and Explanation</title>
		<link>http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/</link>
		<comments>http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 14:00:37 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/</guid>
		<description><![CDATA[I was asked following questions when discussing security issues in meeting with off-shore team of large database consultancy company few days ago. I will only discuss one of the security issue was discussed accidental data modification by developers and DBAs themselves. How to alter modification in database by system admin himself? How to prevent accidents [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=264&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I was asked following questions when discussing security issues in meeting with off-shore team of large database consultancy company few days ago. I will only discuss one of the security issue was discussed accidental data modification by developers and DBAs themselves.</p>
<p style="text-align:justify;"><em>How to alter modification in database by system admin himself?</em></p>
<p style="text-align:justify;">How to prevent accidents due to fat fingers? (Accidental execution of code)</p>
<p style="text-align:justify;">How to display message to contact another developers when another developer tries to modify object another developer working on?</p>
<p style="text-align:justify;">It was interesting conversation. Answer to all the questions is <em>correct assignment of permissions</em> and (when permissions are not an issue) <strong><em>Server and Database Level DDL Triggers</em></strong>. If developers have their own login to SQL Server and it does not have permissions to drop or create objects this will not be issue at all. However, there are still risk of System Admin himself making accidental mistakes. The solution to this will be use Server and Database Level DDL Triggers.</p>
<p style="text-align:justify;">DDL is abbreviation of Data Definition Level. DDL contains schema of the database object. It was always dream of all DBA, when change in mission critical schema of the database or server is attempted it is prevented immediately informing DBA and users automatically. DDL Trigger can now make this dream true. Definition of DDL Trigger (from BOL) is <em><strong>DDL Triggers are a special kind of trigger that fire in response to Data Definition Language (DDL) statements. They can be used to perform administrative tasks in the database such as auditing and regulating database operations.</strong></em></p>
<p style="text-align:justify;">DML is abbreviation of Data Manipulation Level. DML contains the actual data which is stored in the database schema. UPDATE, INSERT, DELETE, SELECT are clause are used to manipulate database. There is following different between DML and DDL triggers.</p>
<ul style="text-align:justify;">
<li>DDL triggers do not support INSTEAD OF feature DML triggers.</li>
<li>DDL triggers do not have feature of inserted and deleted tables like DML triggers as it does not participate in database manipulations.</li>
</ul>
<p style="text-align:justify;">Following example demonstrates how DDL trigger can be used to prevent dropping stored procedure.</p>
<p style="text-align:justify;"><strong>Step 1 :</strong></p>
<pre>First create any sample stored procedure.
<code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks</span><span style="color:gray;">;
</span><span style="color:black;">GO
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">TestSP            
</span><span style="color:blue;">AS
SELECT </span><span style="color:black;">1 test</span><span style="color:gray;">;
</span><span style="color:black;">GO </span></code></pre>
<p style="text-align:justify;"><strong>Step 2 :</strong></p>
<p style="text-align:justify;">Create DDL trigger which will prevent dropping the stored procedure.</p>
<pre><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks
GO </span><span style="color:blue;">
CREATE TRIGGER </span><span style="color:black;">PreventDropSP             </span><span style="color:blue;">
ON DATABASE            
FOR </span><span style="color:black;">DROP_PROCEDURE            
</span><span style="color:blue;">AS
PRINT </span><span style="color:red;">'Dropping Procedure is not allowed. DDL Trigger is preventing this from happening. To drop stored procedure run following script.
Script : DISABLE TRIGGER PreventDropSP ON DATABASE; &lt;Run your DROP SP&gt;; ENABLE TRIGGER PreventDropSP ON DATABASE;'
</span><span style="color:blue;">ROLLBACK</span><span style="color:gray;">;
</span><span style="color:black;">GO </span></code></pre>
<p style="text-align:justify;"><strong>Step 3 :</strong></p>
<p style="text-align:justify;">Now test above trigger by attempting to drop the stored procedure.</p>
<pre><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks
GO
</span><span style="color:blue;">DROP PROCEDURE </span><span style="color:black;">TestSP</span><span style="color:gray;">;
</span><span style="color:black;">GO </span></code></pre>
<p style="text-align:justify;">This should throw following message along with error code 3609 :</p>
<p style="text-align:justify;"><em>Dropping Procedure is not allowed.</em></p>
<p style="text-align:justify;">DDL Trigger is preventing this from happening.</p>
<p style="text-align:justify;">To drop stored procedure run following script.</p>
<p style="text-align:justify;">Script :</p>
<p style="text-align:justify;">DISABLE TRIGGER PreventDropSP ON DATABASE;</p>
<p style="text-align:justify;">&lt;Run your DROP SP&gt;;</p>
<p style="text-align:justify;">ENABLE TRIGGER PreventDropSP ON DATABASE;</p>
<p style="text-align:justify;">Msg 3609, Level 16, State 2, Line 1</p>
<p style="text-align:justify;">The transaction ended in the trigger. The batch has been aborted.</p>
<p style="text-align:justify;"><strong> Step 4 :</strong></p>
<p style="text-align:justify;">Now DISABLE above trigger and it will let you successfully drop the stored procedure previously attempted to drop. Once it is dropped enable trigger again to prevent future accidents.</p>
<pre><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks
GO            
DISABLE </span><span style="color:blue;">TRIGGER </span><span style="color:black;">PreventDropSP </span><span style="color:blue;">ON DATABASE</span><span style="color:gray;">;
</span><span style="color:blue;">DROP PROCEDURE </span><span style="color:black;">TestSP</span><span style="color:gray;">;
</span><span style="color:black;">ENABLE </span><span style="color:blue;">TRIGGER </span><span style="color:black;">PreventDropSP </span><span style="color:blue;">ON DATABASE</span><span style="color:gray;">; </span><span style="color:black;">
GO </span></code></pre>
<p style="text-align:justify;">List of all the DDL events (DROP_PROCEDURE in example above) to use with DDL Trigger are listed on <a href="http://msdn2.microsoft.com/en-us/library/ms189871.aspx" target="_blank">MSDN</a>.</p>
<p style="text-align:justify;">If you want to <a href="http://pinaldave.com/download/DDL%20TRIGGER%20EVENTS.pdf" target="_blank">download local copy</a> click here.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://www.SQLAuthority.com">http://www.SQLAuthority.com</a>)</strong>, <a href="http://technet.microsoft.com/en-us/library/ms190989.aspx" target="_blank">BOL</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/264/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/264/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/264/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=264&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Stored Procedure to display code (text) of Stored Procedure, Trigger, View or Object</title>
		<link>http://blog.sqlauthority.com/2007/05/25/sql-server-stored-procedure-to-display-code-text-of-stored-procedure-trigger-view-or-object/</link>
		<comments>http://blog.sqlauthority.com/2007/05/25/sql-server-stored-procedure-to-display-code-text-of-stored-procedure-trigger-view-or-object/#comments</comments>
		<pubDate>Fri, 25 May 2007 14:00:01 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL View]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Object]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/05/25/sql-server-stored-procedure-to-display-code-text-of-stored-procedure-trigger-view-or-object/</guid>
		<description><![CDATA[This is another popular question I receive. How to see text/content/code of Stored Procedure. System stored procedure that prints the text of a rule, a default, or an unencrypted stored procedure, user-defined function, trigger, or view. Syntax sp_helptext @objname = 'name' sp_helptext [ @objname = ] 'name' [ , [ @columnname = ] computed_column_name Displaying [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=50&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This is another popular question I receive. How to see text/content/code of Stored Procedure. System stored procedure that prints the text of a rule, a default, or an unencrypted stored procedure, user-defined function, trigger, or view.</p>
<p style="text-align:justify;"><strong>Syntax</strong><br />
<strong><code style="font-size:12px;"><span style="color:darkred;">sp_helptext </span><span style="color:#434343;">@objname </span><span style="color:blue;">= </span><span style="color:red;">'name'<br />
</span></code></strong><br />
<code style="font-size:12px;"><span style="color:darkred;">sp_helptext </span><span style="color:black;">[ @objname = ] </span><span style="color:red;">'name' </span><span style="color:black;">[ , [ @columnname = ] computed_column_name </span></code><br />
Displaying the definition of a trigger or stored procedure<br />
<code style="font-size:12px;"><span style="color:darkred;">sp_helptext </span><span style="color:red;">'dbo.nameofsp'</span></code></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong> , <a href="http://msdn2.microsoft.com/en-us/library/ms176112.aspx" target="_blank">BOL</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/50/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/50/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=50&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/05/25/sql-server-stored-procedure-to-display-code-text-of-stored-procedure-trigger-view-or-object/feed/</wfw:commentRss>
		<slash:comments>49</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Disadvantages (Problems) of Triggers</title>
		<link>http://blog.sqlauthority.com/2007/05/24/sql-server-disadvantages-problems-of-triggers/</link>
		<comments>http://blog.sqlauthority.com/2007/05/24/sql-server-disadvantages-problems-of-triggers/#comments</comments>
		<pubDate>Thu, 24 May 2007 15:00:35 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/05/24/sql-server-disadvantages-problems-of-triggers/</guid>
		<description><![CDATA[One of my team member asked me should I use triggers or stored procedure. Both of them has its usage and needs. I just basically told him few issues with triggers. This is small note about our discussion. Disadvantages(Problems) of Triggers It is easy to view table relationships , constraints, indexes, stored procedure in database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=126&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">One of my team member asked me should I use triggers or stored procedure. Both of them has its usage and needs. I just basically told him few issues with triggers. This is small note about our discussion.</p>
<p style="text-align:justify;"><strong>Disadvantages(Problems) of Triggers</strong></p>
<ul style="text-align:justify;">
<li>It is easy to view table relationships , constraints, indexes, stored procedure in database but triggers are difficult to view.</li>
<li>Triggers execute invisible to client-application application. They are not visible or can be traced in debugging code.</li>
<li>It is hard to follow their logic as it they can be fired before or after the database insert/update happens.</li>
<li>It is easy to forget about triggers and if there is no documentation it will be difficult to figure out for new developers for their existence.</li>
<li>Triggers run every time when the database fields are updated and it is overhead on system. It makes system run slower.</li>
</ul>
<p style="text-align:justify;">I do not use triggers. In my whole career I am able to get my work done using Stored Procedures instead of Triggers. (Implementation and Architecture changes are required if either of is to be used to support business logic).</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/126/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/126/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=126&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/05/24/sql-server-disadvantages-problems-of-triggers/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2005 Understanding Trigger Recursion and Nesting with examples</title>
		<link>http://blog.sqlauthority.com/2007/05/18/sql-server-2005-understanding-trigger-recursion-and-nesting-with-examples/</link>
		<comments>http://blog.sqlauthority.com/2007/05/18/sql-server-2005-understanding-trigger-recursion-and-nesting-with-examples/#comments</comments>
		<pubDate>Fri, 18 May 2007 15:00:53 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/05/18/sql-server-2005-understanding-trigger-recursion-and-nesting-with-examples/</guid>
		<description><![CDATA[Trigger events can be fired within another trigger action. One Trigger execution can trigger even on another table or same table. This trigger is called NESTED TRIGGER or RECURSIVE TRIGGER. Nested triggers SQL Server supports the nesting of triggers up to a maximum of 32 levels. Nesting means that when a trigger is fired, it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=119&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Trigger events can be fired within another trigger action. One Trigger execution can trigger even on another table or same table. This trigger is called <em><strong>NESTED TRIGGER</strong></em> or <em><strong>RECURSIVE TRIGGER</strong></em>. Nested triggers SQL Server supports the nesting of triggers up to a <em><strong>maximum of 32 levels</strong></em>. Nesting means that when a trigger is fired, it will also cause another trigger to be fired. If a trigger creates an infinitive loop, the nesting level of 32 will be exceeded and the trigger will cancel with an error message. Recursive triggers When a trigger fires and performs a statement that will cause the same trigger to fire, recursion will occur.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Disable Nesting/Recursing Triggers</span><br />
Following script will stop executing all the nested triggers.<br />
<code style="font-size:12px;"><span style="color:darkred;">sp_CONFIGURE </span><span style="color:red;">'nested_triggers'</span><span style="color:gray;">,</span><span style="color:black;">0<br />
GO<br />
</span><span style="color:blue;">RECONFIGURE<br />
</span><span style="color:black;">GO</span></code></p>
<p>There is also alternate way to stop Trigger Recursion<br />
<code style="font-size:12px;"><span style="color:blue;"><br />
ALTER DATABASE </span><span style="color:black;">databasename<br />
</span><span style="color:blue;">SET </span><span style="color:black;">RECURSIVE_TRIGGERS </span><span style="color:blue;">ON </span><span style="color:gray;">| </span><span style="color:blue;">OFF</span></code></p>
<p><span style="font-weight:bold;">Restrict Trigger Nesting to certain level</span><br />
Put following script in trigger code. This will stop the trigger recursion after certain levels. In following case it will stop after 5 recursion.<br />
<code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">((<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">TRIGGER_NESTLEVEL</span><span style="color:gray;">()) &gt; </span><span style="color:black;">5 </span><span style="color:gray;">)<br />
</span><span style="color:blue;">RETURN<br />
</span></code><br />
Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/119/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/119/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=119&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/05/18/sql-server-2005-understanding-trigger-recursion-and-nesting-with-examples/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Good, Better and Best Programming Techniques</title>
		<link>http://blog.sqlauthority.com/2007/04/28/sql-server-good-better-and-best-programming-techniques/</link>
		<comments>http://blog.sqlauthority.com/2007/04/28/sql-server-good-better-and-best-programming-techniques/#comments</comments>
		<pubDate>Sat, 28 Apr 2007 14:00:12 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBCC]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/28/good-better-and-best-programming-techniques/</guid>
		<description><![CDATA[A week ago, I was invited to meeting of programmers. Subject of meeting was &#8220;Good, Better and Best Programming Techniques&#8221;. I had made small note before I went to meeting, so if I have to talk about or discuss SQL Server it can come handy. Well, I did not get chance to talk on that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=162&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">A week ago, I was invited to meeting of programmers. Subject of meeting was &#8220;Good, Better and Best Programming Techniques&#8221;. I had made small note before I went to meeting, so if I have to talk about or discuss SQL Server it can come handy. Well, I did not get chance to talk on that as it was very causal and just meeting and greetings. Everybody just talked about what they think about their job. I talked very briefly about SQL Server, my current job and some funny incident at work.</p>
<p style="text-align:justify;">Everybody laughed big when I talked about funny bug ticket I received which was about &#8211; Client does not receive Email sent by system. Well, at the end it was resolved without any programming as client did not have email address and needed to open one.</p>
<p style="text-align:justify;">Well, here is my note which I prepared to discuss in meeting. This is not complete and is not in very details. This note contains what I think is best programming technique in SQL. There are lots to add here and many opinion are very generic to SQL and other programming languages.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Notes prepared for &#8220;Good, Better and Best Programming Techniques&#8221; meeting</span></p>
<p style="text-align:justify;">Do not prefix stored procedure with SP_ prefix. As they are first searched in master database, before it is searched in any other database.</p>
<p style="text-align:justify;">Always install latest server packs and security packs.</p>
<p style="text-align:justify;">Make sure your SQL Server runs on optimal hardware. If your operating system supports 64 bit SQL Server, install 64 bit SQL Server on it. Raid 10 Array.</p>
<p style="text-align:justify;">Reduce Network Traffic by using Stored Procedure. Return only required result set from database. If application needs paging it should have done in SQL Server instead of at application level.</p>
<p style="text-align:justify;">After running query check Actual Execution Plan for cost of the query. Query can be analyzed in Database Engine Tuning Advisor.</p>
<p style="text-align:justify;">Use User Defined Functions sparsely, use Stored Procedures instead.</p>
<p style="text-align:justify;">Stored Procedure can achieve all the tasks UDF can do. SP provides much more features than UDFs.</p>
<p style="text-align:justify;">Test system with realistic data rather than sample data. Realistic data provides better scenario for testing and reveals problems with real system before it goes to production.</p>
<p style="text-align:justify;">Do not use SELECT *, use proper column names to decrease network traffic and fewer locks on table.</p>
<p style="text-align:justify;">Avoid Cursors as it results in performance degradation. Sub Query, derived tables, CTE can perform same operation.</p>
<p style="text-align:justify;">Reduces the use of nullable columns.</p>
<p style="text-align:justify;">NULL columns consumes an extra byte on each column used as well as adds overhead in queries. Also NULL is not good for logic development for programmers.</p>
<p style="text-align:justify;">Reduce deadlocks using query hints and proper logic of order in columns.</p>
<p style="text-align:justify;">Normalized database always increases scalability and stability of the system. Do not go over 3rd normal form as it will adversely affect performance.</p>
<p style="text-align:justify;">Use WHERE clauses to compare assertive logic. Use IN rather than NOT IN even though IN will require more value to specify in clause.</p>
<p style="text-align:justify;">BLOBS must be stored filesystem and database should have path to them only. If path is common stored them in application variable and append with filename from the BLOBColumnName.</p>
<p style="text-align:justify;">Always perform referential integrity checks and data validations using constraints such as the foreign key and check constraints.</p>
<p style="text-align:justify;">SQL Server optimizer will use an index scan if the ORDER BY clause is on an indexed column.</p>
<p style="text-align:justify;">Stored Procedure should return same numbers of resultset and same columns in any input parameters. Result Set of Stored Procedure should be deterministic.</p>
<p style="text-align:justify;">Index should be created on highly selective columns, which are used in JOINS, WHERE and ORDER BY clause.</p>
<p style="text-align:justify;">Format SQL Code. Make it readable. Wrap it.</p>
<p style="text-align:justify;">Use Column name in ORDER BY clause instead of numbers.</p>
<p style="text-align:justify;">Do not use TEXT or NTEXT if possible. In SQL Server 2005 use VARCHAR(MAX) or NVARCHAR(MAX).</p>
<p style="text-align:justify;">Join tables in order that they always perform the most restrictive search first to filter out the maximum number of rows in the early phases of a multiple table join.</p>
<p style="text-align:justify;">Remember to SET NOCOUNT ON at the beginning of your SQL bataches, stored procedures, triggers to avoid network traffic. This will also reduct the chances of error on linked server.</p>
<p style="text-align:justify;">Do not use temp tables use CTE or Derived tables instead.</p>
<p style="text-align:justify;">Always take backup of all the data.</p>
<p style="text-align:justify;">Never ever work on production server.</p>
<p style="text-align:justify;">Ask someone for help if you need it. We all need to learn.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/162/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/162/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=162&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/28/sql-server-good-better-and-best-programming-techniques/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers Complete List Download</title>
		<link>http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/</link>
		<comments>http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/#comments</comments>
		<pubDate>Sat, 21 Apr 2007 15:00:58 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. Download SQL Server Interview Questions and Answers Complete List Thank you all for your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=93&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<h3 style="text-align:justify;"></h3>
<p style="text-align:justify;"><strong><a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank">Download SQL Server Interview Questions and Answers Complete List</a></strong></p>
<p style="text-align:justify;">Thank you all for your appreciation about the my recent series of SQL Server Interview Questions and Answers. I enjoyed writing questions and answers. I have got many emails about complete series.</p>
<p style="text-align:justify;"><em>Top most request was to collect series in one big post so they can be easily used. </em>I was asked to provide links to download them so they can be printed and referred.<br />
<em><br />
Another question I received is do I ask the same questions in interviews which I administrate.</em> Answer is YES. Though, I have few other questions, which I ask. All of them I came up myself and answers are unique to questions and not available on-line. Well, long story short, I have compiled list of questions in one PDF. Please download them and use them in your next interview or just for reading purpose.</p>
<p style="text-align:justify;"><strong><a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank">Download SQL Server Interview Questions and Answers Complete List</a></strong></p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p style="text-align:justify;"><strong><br />
Other popular Series</strong><br />
<strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/" target="_blank">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong><br />
<strong><a href="http://blog.sqlauthority.com/2007/07/29/sql-server-data-warehousing-interview-questions-and-answers-complete-list-download/" target="_blank">SQL SERVER &#8211; Data Warehousing Interview Questions and Answers Complete List Download</a></strong><br />
<strong><a href="http://jobs.SQLAuthority.com" target="_blank">DBA Database SQL Job List Search</a></strong></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/93/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/93/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=93&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/feed/</wfw:commentRss>
		<slash:comments>300</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 6</title>
		<link>http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/</link>
		<comments>http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/#comments</comments>
		<pubDate>Fri, 20 Apr 2007 15:00:17 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What are the properties of the Relational tables? Relational tables have six properties: Values [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=64&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><span style="font-weight:bold;">What are the properties of the Relational tables?</span><br />
Relational tables have six properties:</p>
<ul style="text-align:justify;">
<li> Values are atomic.</li>
<li> Column values are of the same kind.</li>
<li> Each row is unique.</li>
<li> The sequence of columns is insignificant.</li>
<li> The sequence of rows is insignificant.</li>
<li> Each column must have a unique name.</li>
</ul>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is De-normalization?</span><br />
De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. It is sometimes necessary because current DBMSs implement the relational model poorly. A true relational DBMS would allow for a fully normalized database at the logical level, while providing physical storage of data that is tuned for high performance. De-normalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> How to get @@error and @@rowcount at the same time?<br />
</span>If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset.<br />
And if @@Recordcount is checked before the error-checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Identity?</span><br />
Identity (or AutoNumber) is a column that automatically generates numeric values. A start and increment value can be set, but most DBA leave these at 1. A GUID column also generates numbers, the value of this cannot be controled. Identity/GUID columns do not need to be indexed.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is a Scheduled Jobs or What is a Scheduled Tasks? </span><br />
Scheduled tasks let user automate processes that run on regular or predictable cycles. User can schedule administrative tasks, such as cube processing, to run during times of slow business activity. User can also determine the order in which tasks run by creating job steps within a SQL Server Agent job. E.g. Back up database, Update Stats of Tables. Job steps give user control over flow of execution.  If one job fails, user can configure SQL Server Agent to continue to run the remaining tasks or to stop execution.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is a table called, if it does not have neither Cluster nor Non-cluster Index? What is it used for?<br />
</span>Unindexed table or <span style="font-weight:bold;font-style:italic;">Heap</span>. Microsoft Press Books and Book On Line (BOL) refers it as Heap.<br />
A heap is a table that does not have a clustered index and, therefore, the pages are not linked by pointers. The IAM pages are the only structures that link the pages in a table together.<br />
Unindexed tables are good for fast storing of data. Many times it is better to drop all indexes from table and than do bulk of inserts and to restore those indexes after that.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is BCP? When does it used? </span><br />
BulkCopy is a tool used to copy huge amount of data from tables and views. BCP does not copy the structures same as source to destination.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> How do you load large data to the SQL server database?<br />
</span>BulkCopy is a tool used to copy huge amount of data from tables. BULK INSERT command helps to Imports a data file into a database table or view in a user-specified format.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> Can we rewrite subqueries into simple select statements or with joins? </span><br />
Subqueries can often be re-written to use a standard      outer join, resulting in faster performance.  As we may know, an outer join      uses the plus sign (+) operator to tell the database to return all      non-matching rows with NULL values.  Hence we combine the outer join with a      NULL test in the WHERE clause to reproduce the result set without using a      sub-query.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Can SQL Servers linked to other servers like Oracle?</span><br />
SQL Server can be lined to any server provided it has OLE-DB provider from Microsoft to allow a link. E.g. Oracle has a OLE-DB provider for oracle that Microsoft provides to add it as linked server to SQL Server group.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> How to know which index a table is using? </span><br />
SELECT table_name,index_name FROM user_constraints</p>
<p style="text-align:justify;"><span style="font-weight:bold;">How to copy the tables, schema and views from one SQL server to another?</span><br />
Microsoft SQL Server 2000 Data Transformation Services (DTS) is a set of graphical tools and programmable objects that lets user extract, transform, and consolidate data from disparate sources into single or multiple destinations.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Self Join?</span><br />
This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company have a hierarchal reporting structure whereby one member of staff reports to another.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Cross Join?</span><br />
A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. The common example is when company wants to combine each product with a pricing table to analyze each product at each price.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Which virtual table does a trigger use?</span><br />
Inserted and Deleted.
</p>
<p style="text-align:justify;"><span style="font-weight:bold;">List few advantages of Stored Procedure.</span></p>
<ul style="text-align:justify;">
<li>Stored procedure can reduced network traffic and latency, boosting application performance.</li>
<li>Stored procedure execution plans can be reused, staying cached in SQL Server&#8217;s memory, reducing server overhead.</li>
<li>Stored procedures help promote code reuse.</li>
<li>Stored procedures can encapsulate logic. You can change stored procedure code without affecting clients.</li>
<li>Stored procedures provide better security to your data.</li>
</ul>
<p style="text-align:justify;"><span style="font-weight:bold;">What is DataWarehousing?</span></p>
<ul style="text-align:justify;">
<li><strong>Subject-oriented</strong>, meaning that the data in the database is organized so that all the data elements relating to the same real-world event or object are linked together;</li>
<li><strong>Time-variant</strong>, meaning that the changes to the data in the database are tracked and recorded so that reports can be produced showing changes over time;</li>
<li><strong>Non-volatile</strong>, meaning that data in the database is never over-written or deleted, once committed, the data is static, read-only, but retained for future reporting;</li>
<li><strong>Integrated</strong>, meaning that the database contains data from most or all of an organization&#8217;s operational applications, and that this data is made consistent.</li>
</ul>
<p style="text-align:justify;"><span style="font-weight:bold;">What is OLTP(OnLine Transaction Processing)?</span><br />
In OLTP &#8211; online transaction processing systems relational database design use the discipline of data modeling and generally follow the Codd rules of data normalization in order to ensure absolute data integrity. Using these rules complex information is broken down into its most simple structures (a table) where all of the individual atomic level elements relate to each other and satisfy the normalization rules.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> How do SQL server 2000 and XML linked? Can XML be used to access data?</span><br />
<span style="font-style:italic;font-weight:bold;">FOR XML (ROW, AUTO, EXPLICIT)</span><br />
You can execute SQL queries against existing relational databases to return results as XML rather than standard rowsets. These queries can be executed directly or from within stored procedures. To retrieve XML results, use the FOR XML clause of the SELECT statement and specify an XML mode of RAW, AUTO, or EXPLICIT.</p>
<p style="text-align:justify;"><span style="font-weight:bold;font-style:italic;">OPENXML</span><br />
OPENXML is a Transact-SQL keyword that provides a relational/rowset view over an in-memory XML document. OPENXML is a rowset provider similar to a table or a view. OPENXML provides a way to access XML data within the Transact-SQL context by transferring data from an XML document into the relational tables. Thus, OPENXML allows you to manage an XML document and its interaction with the relational environment.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is an execution plan? When would you use it? How would you view the execution plan?</span><br />
An execution plan is basically a road map that graphically or textually shows the data retrieval methods chosen by the SQL Server query optimizer for a stored procedure or ad-hoc query and is a very useful tool for a developer to understand the performance characteristics of a query or stored procedure since the plan is the one that SQL Server will place in its cache and use to execute the stored procedure or query. From within Query Analyzer is an option called &#8220;Show Execution Plan&#8221; (located on the Query drop-down menu). If this option is turned on it will display query execution plan in separate window when query is ran again.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/64/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/64/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=64&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/feed/</wfw:commentRss>
		<slash:comments>83</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 5</title>
		<link>http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/</link>
		<comments>http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/#comments</comments>
		<pubDate>Thu, 19 Apr 2007 15:00:06 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What command do we use to rename a db? sp_renamedb ‘oldname’ , ‘newname’ If [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=62&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><span style="font-weight:bold;"> What command do we use to rename a db? </span><br />
sp_renamedb ‘oldname’ , ‘newname’<br />
If someone is using db it will not accept sp_renmaedb. In that case first bring db to single user using sp_dboptions. Use sp_renamedb to rename database. Use sp_dboptions to bring database to multi user mode.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is sp_configure commands and set commands?</span><br />
Use sp_configure to display or change server-level settings. To change database-level settings, use ALTER DATABASE. To change settings that affect only the current user session, use the SET statement.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What are the different types of replication? Explain.</span><br />
The SQL Server 2000-supported replication types are as follows:</p>
<ul style="text-align:justify;">
<li> Transactional</li>
<li> Snapshot</li>
<li> Merge</li>
</ul>
<p style="text-align:justify;"><strong><span style="font-style:italic;">Snapshot replication</span></strong> distributes data exactly as it appears at a specific moment in time and does not monitor for updates to the data. Snapshot replication is best used as a method for replicating data that changes infrequently or where the most up-to-date values (low latency) are not a requirement. When synchronization occurs, the entire snapshot is generated and sent to Subscribers.</p>
<p style="text-align:justify;"><strong><span style="font-style:italic;">Transactional replication</span></strong>, an initial snapshot of data is applied at Subscribers, and then when data modifications are made at the Publisher, the individual transactions are captured and propagated to Subscribers.</p>
<p style="text-align:justify;"><strong><span style="font-style:italic;">Merge replication</span></strong> is the process of distributing data from Publisher to Subscribers, allowing the Publisher and Subscribers to make updates while connected or disconnected, and then merging the updates between sites when they are connected.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What are the OS services that the SQL Server installation adds?</span><br />
MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What are three SQL keywords used to change or set someone’s permissions?<br />
</span>GRANT, DENY, and REVOKE.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What does it mean to have quoted_identifier on? What are the implications of having it off?</span><br />
When SET QUOTED_IDENTIFIER is ON, identifiers can be delimited by double quotation marks, and literals must be delimited by single quotation marks. When SET QUOTED_IDENTIFIER is OFF, identifiers cannot be quoted and must follow all Transact-SQL rules for identifiers.</p>
<p><span style="font-weight:bold;">What is the STUFF function and how does it differ from the REPLACE function? </span><br />
<strong>STUFF</strong> function to overwrite existing characters. Using this syntax, STUFF(string_expression, start, length, replacement_characters), string_expression is the string that will have characters substituted, start is the starting position, length is the number of characters in the string that are substituted, and replacement_characters are the new characters interjected into the string.<br />
<strong>REPLACE</strong> function to replace existing characters of all occurance. Using this syntax REPLACE(string_expression, search_string, replacement_string), where every incidence of search_string found in the string_expression will be replaced with replacement_string.
</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> Using query analyzer, name 3 ways to get an accurate count of the number of records in a table?</span><br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">table1<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">COUNT</span><span style="color:gray;">(*)<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">table1<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">rows<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sysindexes<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">id </span><span style="color:blue;">= </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">(</span><span style="color:black;">table1</span><span style="color:gray;">)<br />
AND </span><span style="color:black;">indid </span><span style="color:gray;">&lt; </span><span style="color:black;">2</span></code><br />
<span style="font-weight:bold;">How to rebuild Master Database?</span><br />
Shutdown Microsoft SQL Server 2000, and then run Rebuildm.exe. This is located in the Program Files\Microsoft SQL Server\80\Tools\Binn directory.<br />
In the Rebuild Master dialog box, click Browse.<br />
In the Browse for Folder dialog box, select the \Data folder on the SQL Server 2000 compact disc or in the shared network directory from which SQL Server 2000 was installed, and then click OK.<br />
Click Settings. In the Collation Settings dialog box, verify or change settings used for the master database and all other databases.<br />
Initially, the default collation settings are shown, but these may not match the collation selected during setup. You can select the same settings used during setup or select new collation settings. When done, click OK.<br />
In the Rebuild Master dialog box, click Rebuild to start the process.<br />
The Rebuild Master utility reinstalls the master database.<br />
To continue, you may need to stop a server that is running.<br />
Source: http://msdn2.microsoft.com/en-us/library/aa197950(SQL.80).aspx</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is the basic functions for master, msdb, model, tempdb databases?</span><br />
The <span style="font-weight:bold;font-style:italic;">Master</span> database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care.<br />
The <span style="font-weight:bold;font-style:italic;">msdb </span>database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping.<br />
The <span style="font-weight:bold;font-style:italic;">tempdb</span> holds temporary objects such as global and local temporary tables and stored procedures.<br />
The <span style="font-weight:bold;font-style:italic;">model</span> is essentially a template database used in the creation of any new user database created in the instance.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What are primary keys and foreign keys? </span><br />
<span style="font-style:italic;font-weight:bold;">Primary keys</span> are the unique identifiers for each row. They must contain unique values and cannot be null. Due to their importance in relational databases, Primary keys are the most fundamental of all keys and constraints. A table can have only one Primary key.<br />
<span style="font-weight:bold;font-style:italic;">Foreign keys</span> are both a method of ensuring data integrity and a manifestation of the relationship between tables.</p>
<p style="text-align:justify;"><strong> What is data integrity? Explain constraints?</strong><br />
<span class="DropCap">D</span>ata integrity is an important feature in SQL Server. When used properly, it ensures that data is accurate, correct, and valid. It also acts as a trap for otherwise undetectable bugs within applications.</p>
<p>A <strong>PRIMARY KEY</strong> constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.
</p>
<p style="text-align:justify;">A <strong>UNIQUE</strong> constraint enforces the uniqueness of the values in a set of columns, so no duplicate values are entered. The unique key constraints are used to enforce entity integrity as the primary key constraints.</p>
<p style="text-align:justify;">A <strong>FOREIGN KEY</strong> constraint prevents any actions that would destroy links between tables with the corresponding data values. A foreign key in one table points to a primary key in another table. Foreign keys prevent actions that would leave rows with foreign key values when there are no primary keys with that value. The foreign key constraints are used to enforce referential integrity.</p>
<p style="text-align:justify;">A <strong>CHECK</strong> constraint is used to limit the values that can be placed in a column. The check constraints are used to enforce domain integrity.</p>
<p style="text-align:justify;">A <strong>NOT NULL</strong> constraint enforces that the column will not accept null values. The not null constraints are used to enforce domain integrity, as the check constraints.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/62/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/62/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=62&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 4</title>
		<link>http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/</link>
		<comments>http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 15:00:12 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What is SQL Profiler? SQL Profiler is a graphical tool that allows system administrators [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=61&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><span style="font-weight:bold;">What is SQL Profiler?</span><br />
SQL Profiler is a graphical tool that allows system administrators to monitor events in an instance of Microsoft SQL Server. You can capture and save data about each event to a file or SQL Server table to analyze later. For example, you can monitor a production environment to see which stored procedures are hampering performance by executing too slowly.
</p>
<p style="text-align:justify;">Use SQL Profiler to monitor only the events in which you are interested. If traces are becoming too large, you can filter them based on the information you want, so that only a subset of the event data is collected. Monitoring too many events adds overhead to the server and the monitoring process and can cause the trace file or trace table to grow very large, especially when the monitoring process takes place over a long period of time.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is User Defined Functions?</span><br />
User-Defined Functions allow to define its own T-SQL functions that can accept 0 or more parameters and return a single scalar data value or a table data type.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What kind of User-Defined Functions can be created?</span><br />
There are three types of User-Defined functions in SQL Server 2000 and they are Scalar, Inline Table-Valued and Multi-statement Table-valued.</p>
<p style="text-align:justify;"><em><span style="font-weight:bold;">Scalar User-Defined Function</span></em><br />
A Scalar user-defined function returns one of the scalar data types. Text, ntext, image and timestamp data types are not supported. These are the type of user-defined functions that most developers are used to in other programming languages. You pass in 0 to many parameters and you get a return value.</p>
<p style="text-align:justify;"><em><span style="font-weight:bold;">Inline Table-Value User-Defined Function</span></em><br />
An Inline Table-Value user-defined function returns a table data type and is an exceptional alternative to a view as the user-defined function can pass parameters into a T-SQL select command and in essence provide us with a parameterized, non-updateable view of the underlying tables.</p>
<p style="text-align:justify;"><em><span style="font-weight:bold;">Multi-statement Table-Value User-Defined Function</span></em><br />
A Multi-Statement Table-Value user-defined function returns a table and is also an exceptional alternative to a view as the function can support multiple T-SQL statements to build the final result where the view is limited to a single SELECT statement. Also, the ability to pass parameters into a T-SQL select command or a group of them gives us the capability to in essence create a parameterized, non-updateable view of the data in the underlying tables. Within the create function command you must define the table structure that is being returned. After creating this type of user-defined function, It can be used in the FROM clause of a T-SQL command unlike the behavior found when using a stored procedure which can also return record sets.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Which TCP/IP port does SQL Server run on? How can it be changed?</span><br />
SQL Server runs on port 1433. It can be changed from the Network Utility TCP/IP properties –&gt; Port number.both on client and the server.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What are the authentication modes in SQL Server? How can it be changed?</span><br />
Windows mode and mixed mode (SQL &amp; Windows).
</p>
<p style="text-align:justify;">To change authentication mode in SQL Server click Start, Programs, Microsoft SQL Server and click SQL Enterprise Manager to run SQL Enterprise Manager from the Microsoft SQL Server program group. Select the server then from the Tools menu select SQL Server Configuration Properties, and choose the Security page.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Where are SQL server users names and passwords are stored in sql server?</span><br />
They get stored in master db in the sysxlogins table.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">Which command using Query Analyzer will give you the version of SQL server and operating system? </span><br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">SERVERPROPERTY</span><span style="color:gray;">(</span><span style="color:red;">'productversion'</span><span style="color:gray;">), </span><span style="color:magenta;">SERVERPROPERTY </span><span style="color:gray;">(</span><span style="color:red;">'productlevel'</span><span style="color:gray;">), </span></code><br />
<span style="font-weight:bold;"> What is SQL server agent?<br />
</span>SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full-function scheduling engine, which allows you to schedule your own jobs and scripts.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> Can a stored procedure call itself or recursive stored procedure? How many level SP nesting possible?</span><br />
Yes. Because Transact-SQL supports recursion, you can write stored procedures that call themselves. Recursion can be defined as a method of problem solving wherein the solution is arrived at by repetitively applying it to subsets of the problem. A common application of recursive logic is to perform numeric computations that lend themselves to repetitive evaluation by the same processing steps. Stored procedures are nested when one stored procedure calls another or executes managed code by referencing a CLR routine, type, or aggregate. You can nest stored procedures and managed code references up to 32 levels.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is @@ERROR?</span><br />
The @@ERROR automatic variable returns the error code of the last Transact-SQL statement. If there was no error, @@ERROR returns zero. Because @@ERROR is reset after each Transact-SQL statement, it must be saved to a variable if it is needed to process it further after checking it.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Raiseerror? </span><br />
Stored procedures report errors to client applications via the RAISERROR command. RAISERROR doesn&#8217;t change the flow of a procedure; it merely displays an error message, sets the @@ERROR automatic variable, and optionally writes the message to the SQL Server error log and the NT application event log.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is log shipping?</span><br />
Log shipping is the process of automating the backup of database and transaction log files on a production SQL server, and then restoring them onto a standby server. Enterprise Editions only supports log shipping. In log shipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db can be used this as the Disaster Recovery plan.  The key feature of log shipping is that is will automatically backup transaction logs throughout the day and automatically restore them on the standby server at defined interval.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is the difference between a local and a global variable?</span><br />
A <span style="font-style:italic;">local temporary </span>table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.
</p>
<p style="text-align:justify;">A <span style="font-style:italic;">global temporary</span> table remains in the database permanently, but the rows exist only within a given connection. When connection are closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/61/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/61/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/61/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/61/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/61/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=61&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 3</title>
		<link>http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/</link>
		<comments>http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/#comments</comments>
		<pubDate>Tue, 17 Apr 2007 15:00:09 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Sub Query]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/17/private-sql-server-interview-questions-part-3/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What is a NOLOCK? Using the NOLOCK query optimiser hint is generally considered good [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=58&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><strong>What is a NOLOCK?</strong><br />
Using the NOLOCK query optimiser hint is generally considered good practice in order to improve concurrency on a busy system. When the NOLOCK hint is included in a SELECT statement, no locks are taken when data is read. The result is a Dirty Read, which means that another process could be updating the data at the exact time you are reading it. There are no guarantees that your query will retrieve the most recent data. The advantage to performance is that your reading of data will not block updates from taking place, and updates will not block your reading of data. SELECT statements take Shared (Read) locks. This means that multiple SELECT statements are allowed simultaneous access, but other processes are blocked from modifying the data. The updates will queue until all the reads have completed, and reads requested after the update will wait for the updates to complete. The result to your system is delay(blocking).</p>
<p style="text-align:justify;"><strong>What is difference between DELETE &amp; TRUNCATE commands?</strong><br />
Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.</p>
<p style="text-align:justify;"><em><strong>TRUNCATE</strong></em><br />
TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.<br />
TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations are recorded in the transaction log.<br />
TRUNCATE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column.<br />
You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint.<br />
Because TRUNCATE TABLE is not logged, it cannot activate a trigger.<br />
TRUNCATE can not be Rolled back using logs.<br />
TRUNCATE is DDL Command.<br />
TRUNCATE Resets identity of the table.</p>
<p style="text-align:justify;"><em><strong>DELETE</strong></em><br />
DELETE removes  rows one at a time and records an entry in the transaction log for each deleted row.<br />
If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement.<br />
DELETE Can be used with or without a WHERE clause<br />
DELETE Activates Triggers.<br />
DELETE Can be Rolled back using logs.<br />
DELETE is DML Command.<br />
DELETE does not reset identity of the table.</p>
<p style="text-align:justify;"><strong>Difference between Function and Stored Procedure?</strong><br />
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.<br />
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.<br />
Inline UDF&#8217;s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.</p>
<p style="text-align:justify;"><strong>When is the use of UPDATE_STATISTICS command?</strong><br />
This command is basically used when a large processing of data has occurred. If a large amount of deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.</p>
<p style="text-align:justify;"><strong>What types of Joins are possible with Sql Server?</strong><br />
Joins are used in queries to explain how different tables are related. Joins also let you select data from a table depending upon data from another table.<br />
Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL OUTER JOINS.</p>
<p style="text-align:justify;"><strong>What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?</strong><br />
Specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause. Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query. HAVING criteria is applied after the the grouping of rows has occurred.</p>
<p style="text-align:justify;"><strong>What is sub-query? Explain properties of sub-query.</strong><br />
Sub-queries are often referred to as sub-selects, as they allow a SELECT statement to be executed arbitrarily within the body of another SQL statement. A sub-query is executed by enclosing it in a set of parentheses. Sub-queries are generally used to return a single row as an atomic value, though they may be used to compare values against multiple rows with the IN keyword.
</p>
<p style="text-align:justify;">A subquery is a SELECT statement that is nested within another T-SQL statement. A subquery SELECT statement if executed independently of the T-SQL statement, in which it is nested, will return a result set. Meaning a subquery SELECT statement can standalone and is not depended on the statement in which it is nested. A subquery SELECT statement can return any number of values, and can be found in, the column list of a SELECT statement, a FROM, GROUP BY, HAVING, and/or ORDER BY clauses of a T-SQL statement. A Subquery can also be used as a parameter to a function call. Basically a subquery can be used anywhere an expression can be used.</p>
<p style="text-align:justify;"><em><strong>Properties of Sub-Query</strong></em><br />
A subquery must be enclosed in the parenthesis.<br />
A subquery must be put in the right hand of the comparison operator, and<br />
A subquery cannot contain a ORDER-BY clause.<br />
A query can contain more than one sub-queries.</p>
<p style="text-align:justify;"><strong>What are types of sub-queries?</strong><br />
Single-row subquery, where the subquery returns only one row.<br />
Multiple-row subquery, where the subquery returns multiple rows,.and<br />
Multiple column subquery, where the subquery returns multiple columns.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers -Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/58/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/58/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=58&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 2</title>
		<link>http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/</link>
		<comments>http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 15:00:56 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBCC]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Collation]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What is the difference between clustered and a non-clustered index? A clustered index is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=55&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><span style="font-weight:bold;">What is the difference between clustered and a non-clustered index?</span><br />
A <span style="font-style:italic;">clustered index</span> is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
</p>
<p style="text-align:justify;">A <span style="font-style:italic;">nonclustered index</span> is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What are the different index configurations a table can have?</span><br />
A table can have one of the following index configurations:</p>
<p style="margin-left:40px;text-align:justify;">No indexes<br />
A clustered index<br />
A clustered index and many nonclustered indexes<br />
A nonclustered index<br />
Many nonclustered indexes</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is cursors?</span><br />
Cursor is a database object used by applications to manipulate data in a set on a row-by-row basis, instead of the typical SQL commands that operate on all the rows in the set at one time.
</p>
<p style="text-align:justify;">In order to work with a cursor we need to perform some steps in the following order:</p>
<p style="margin-left:40px;text-align:justify;">Declare  cursor<br />
Open cursor<br />
Fetch row from the cursor<br />
Process fetched row<br />
Close cursor<br />
Deallocate cursor</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is the use of DBCC commands?</span><br />
DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.<br />
E.g. DBCC CHECKDB &#8211; Ensures that tables in the db and the indexes are correctly linked.<br />
DBCC CHECKALLOC &#8211; To check that all pages in a db are correctly allocated.<br />
DBCC CHECKFILEGROUP &#8211; Checks all tables file group for any damage.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is a Linked Server?</span><br />
Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements. With a linked server, you can create very clean, easy to follow, SQL statements that allow remote data to be retrieved, joined and combined with local data.<br />
Storped Procedure sp_addlinkedserver, sp_addlinkedsrvlogin will be used add new Linked Server.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Collation?<br />
</span>Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width.</p>
<p style="text-align:justify;"><strong>What are different type of Collation Sensitivity?</strong><br />
<span style="font-style:italic;">Case sensitivity</span><br />
A and a, B and b, etc.</p>
<p style="text-align:justify;"><span style="font-style:italic;">Accent sensitivity</span><br />
a and á, o and ó, etc.</p>
<p style="text-align:justify;"><span style="font-style:italic;">Kana Sensitivity</span><br />
When Japanese kana characters Hiragana and Katakana are treated differently, it is called Kana sensitive.</p>
<p style="text-align:justify;"><span style="font-style:italic;">Width sensitivity</span><br />
When a single-byte character (half-width) and the same character when represented as a double-byte character (full-width) are treated differently then it is width sensitive.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What&#8217;s the difference between a primary key and a unique key?</span><br />
Both primary key and unique enforce uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a nonclustered index by default. Another major difference is that, primary key doesn&#8217;t allow NULLs, but unique key allows one NULL only.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?</span><br />
One-to-One relationship can be implemented as a single table and rarely as two tables with primary and foreign key relationships.<br />
One-to-Many relationships are implemented by splitting the data into two tables with primary key and foreign key relationships.<br />
Many-to-Many relationships are implemented using a junction table with the keys from both the tables forming the composite primary key of the junction table.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=55&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Part 1</title>
		<link>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/</link>
		<comments>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/#comments</comments>
		<pubDate>Sun, 15 Apr 2007 15:00:20 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/</guid>
		<description><![CDATA[SQL Server Interview Questions and Answers Print Book Available (207 Pages) &#124; Sample Chapters UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=45&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<table class="sample">
<tr>
<td>SQL Server Interview Questions and Answers</td>
</tr>
<tr>
<td><a href="http://bit.ly/sqlinterviewbook" target="_blank" class="sample1">Print Book Available (207 Pages)</a> | <a href="http://www.pinaldave.com/sql-downloads/pdf-download/sql-server-2008-interview-questions-and-answers-download/" target="_blank" class="sample1">Sample Chapters</a></td>
</tr>
</table>
<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is RDBMS?</span><br />
Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependencies among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is normalization?</span><br />
Database normalization is a data design and organization process applied to data structures based on rules that help build relational databases. In relational database design, the process of organizing data to minimize redundancy. Normalization usually involves dividing a database into two or more tables and defining relationships between the tables. The objective is to isolate data so that additions, deletions, and modifications of a field can be made in just one table and then propagated through the rest of the database via the defined relationships.<br />
<span><br />
<span style="font-weight:bold;">What are different normalization forms?</span></span></p>
<p style="text-align:justify;"><span style="font-weight:bold;font-style:italic;">1NF: Eliminate Repeating Groups</span><br />
Make a separate table for each set of related attributes, and give each table a primary key. Each field contains at most one value from its attribute domain.<br />
<span><span style="font-weight:bold;font-style:italic;">2NF: Eliminate Redundant Data</span><br />
If an attribute depends on only part of a multi-valued key, remove it to a separate table.<br />
<span style="font-weight:bold;font-style:italic;">3NF: Eliminate Columns Not Dependent On Key </span><br />
If attributes do not contribute to a description of the key, remove them to a separate table. </span> All attributes must be directly dependent on the primary key<br />
<span><span style="font-weight:bold;font-style:italic;">BCNF: Boyce-Codd Normal Form</span><br />
If there are non-trivial dependencies between candidate key attributes, separate them out into distinct tables.<br />
<span style="font-weight:bold;font-style:italic;">4NF: Isolate Independent Multiple Relationships</span><br />
No table may contain two or more 1:n or n:m relationships that are not directly related.<br />
<span style="font-weight:bold;font-style:italic;">5NF: Isolate Semantically Related Multiple Relationships </span><br />
There may be practical constrains on information that justify separating logically related many-to-many relationships.<br />
<span style="font-weight:bold;font-style:italic;">ONF: Optimal Normal Form</span><br />
A model limited to only simple (elemental) facts, as expressed in Object Role Model notation.<br />
<span style="font-weight:bold;font-style:italic;">DKNF: Domain-Key Normal Form</span><br />
A model free from all modification anomalies.</span>
</p>
<p style="text-align:justify;">Remember, these normalization guidelines are cumulative. For a database to be in 3NF, it must first fulfill all the criteria of a 2NF and 1NF database.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Stored Procedure?<br />
</span>A stored procedure is a named group of SQL statements that have been previously created and stored in the server database. Stored procedures accept input parameters so that a single procedure can be used over the network by several clients using different input data. And when the procedure is modified, all clients automatically get the new version. Stored procedures reduce network traffic and improve performance. Stored procedures can be used to help ensure the integrity of the database.<br />
e.g. sp_helpdb, sp_renamedb, sp_depends etc.</p>
<p style="text-align:justify;"><span style="font-weight:bold;"> What is Trigger?</span><br />
<span>A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS.Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion.  A trigger cannot be called or executed; the DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.</span><br />
<span> <span style="font-style:italic;">Nested Trigger: </span>A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.</span></p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is View?</span><br />
<span class="main">A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting rows. Rows updated or deleted in the view are updated or deleted in the table the view was created with. It should also be noted that as data in the original table changes, so does data in the view, as views are the way to look at part of the original table.</span> The results of using a view are not permanently stored in the database. The data accessed through a view is actually constructed using standard T-SQL select command and can come from one to many different base tables or even other views.</p>
<p style="text-align:justify;"><span style="font-weight:bold;">What is Index?</span><br />
An index is a physical structure containing pointers to the data. Indices are created in an existing table to locate rows more quickly and efficiently. It is possible to create an index on one or more columns of a table, and each index is given a name. The users cannot see the indexes, they are just used to speed up queries. Effective indexes are one of the best ways to improve performance in a database application. A table scan happens when there is no index available to help a query. In a table scan SQL Server examines every row in the table to satisfy the query results. Table scans are sometimes unavoidable, but on large tables, scans have a terrific impact on performance.</p>
<p style="text-align:justify;"><span style="font-style:italic;">Clustered indexes</span> define the physical sorting of a database table’s rows in the storage media. For this reason, each database table may have only one clustered index.<br />
<span style="font-style:italic;">Non-clustered indexes</span> are created outside of the database table and contain a sorted list of references to the table itself.</p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers -Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=45&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Interview Questions and Answers &#8211; Introduction</title>
		<link>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/</link>
		<comments>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/#comments</comments>
		<pubDate>Sun, 15 Apr 2007 14:00:09 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[About Me]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/</guid>
		<description><![CDATA[UPDATE : Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. New Location : SQL Server 2008 Interview Questions and Answers. Hello All, Thank you all for sending request for Interview Questions and Answers. It begins from today. This is six part series. I will update this post once [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=134&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h4 style="text-align:justify;"><span style="color:#ff0000;"><strong>UPDATE </strong>: Interview Questions and Answers are now updated with SQL Server 2008 Questions and its answers. <strong>New Location : <a href="http://blog.sqlauthority.com/2008/09/20/sql-server-2008-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server 2008 Interview Questions and Answers.</a></strong></span></h4>
<p style="text-align:justify;">Hello All,</p>
<p style="text-align:justify;">Thank you all for sending request for <strong>Interview Questions and Answers</strong>. It begins from today. This is six part series. I will update this post once all the six parts are published.</p>
<p style="text-align:justify;">Thank you to the regular reader (name not published as per request) who sent me <strong>new banner</strong> for this blog. I hope you all like it.</p>
<p style="text-align:justify;">I have done my best to answer all the emails and comments I have received.  Only those comments are published which are adding something more to original post.</p>
<p style="text-align:justify;">I always welcome email/comments, whether you&#8217;re interested in talking about my projects, MS SQL SERVER, ColdFusion, Web Architecture, or have taken an online tutorial class of mine, or even have an event where you believe I&#8217;d be a great speaker or panelist. Or just feel free to say &#8220;hi&#8221; too.</p>
<p style="text-align:justify;"><strong>Pinal Dave</strong><strong></strong></p>
<p style="text-align:justify;"><strong>Complete Series of SQL Server Interview Questions and Answers</strong><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/">SQL Server Interview Questions and Answers -Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions/">SQL Server Interview Questions and Answers &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/04/16/sql-server-interview-questions-part-2/">SQL Server Interview Questions and Answers &#8211; Part 2</a><br />
<a href="http://blog.sqlauthority.com/2007/04/17/sql-server-interview-questions-part-3/">SQL Server Interview Questions and Answers &#8211; Part 3</a><br />
<a href="http://blog.sqlauthority.com/2007/04/18/sql-server-interview-questions-part-4/">SQL Server Interview Questions and Answers &#8211; Part 4</a><br />
<a href="http://blog.sqlauthority.com/2007/04/19/sql-server-interview-questions-part-5/">SQL Server Interview Questions and Answers &#8211; Part 5</a><br />
<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">SQL Server Interview Questions and Answers &#8211; Part 6</a><br />
<a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/"><strong>SQL Server Interview Questions and Answers Complete List Download</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/134/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/134/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=134&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/15/sql-server-interview-questions-and-answers-introduction/feed/</wfw:commentRss>
		<slash:comments>217</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2005 &#8211; Disable Triggers &#8211; Drop Triggers</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/</link>
		<comments>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 15:00:11 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/</guid>
		<description><![CDATA[There are two ways to prevent trigger from firing. 1) Drop Trigger Example: DROP TRIGGER TriggerName GO 2) Disable Trigger DML trigger can be disabled two ways. Using ALETER TABLE statement or use DISABLE TRIGGER. I prefer DISABLE TRIGGER statement. Syntax: DISABLE TRIGGER { [ schema . ] trigger_name [ ,...n ] &#124; ALL } [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=118&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">There are two ways to prevent trigger from firing.</p>
<p><strong>1) Drop Trigger</strong><br />
<em><strong>Example:</strong></em><br />
<code style="font-size:12px;"><span style="color:blue;">DROP TRIGGER </span><span style="color:black;">TriggerName<br />
GO<br />
</span></code><br />
<strong>2)  Disable Trigger</strong><br />
DML trigger can be disabled two ways. Using ALETER TABLE statement or use DISABLE TRIGGER. I prefer DISABLE TRIGGER statement.<br />
<em><strong>Syntax:</strong></em><br />
<code style="font-size:12px;"><span style="color:black;">DISABLE </span><span style="color:blue;">TRIGGER </span><span style="color:black;">{ [ schema . ] trigger_name<br />
[ ,...n ] </span><span style="color:gray;">| ALL </span><span style="color:black;">}<br />
</span><span style="color:blue;">ON </span><span style="color:black;">{ </span><span style="color:magenta;">OBJECT_NAME </span><span style="color:gray;">| </span><span style="color:blue;">DATABASE </span><span style="color:gray;">| ALL </span><span style="color:black;">SERVER } [ ; ]</span></code><br />
<em><strong>Example:</strong></em><br />
<code style="font-size:12px;"><span style="color:black;">DISABLE </span><span style="color:blue;">TRIGGER </span><span style="color:black;">TriggerName </span><span style="color:blue;">ON </span><span style="color:black;">TableName</span></code></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/118/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/118/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=118&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
	</channel>
</rss>
