<?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 Security</title>
	<atom:link href="http://blog.sqlauthority.com/category/sql-security/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:09:17 +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 Security</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; 2012 Auditing Enhancement &#8211; On Audit Log Failure Options &#8211; Maximum Rollover Files</title>
		<link>http://blog.sqlauthority.com/2011/12/16/sql-server-2012-auditing-enhancement-on-audit-log-failure-options-maximum-rollover-files/</link>
		<comments>http://blog.sqlauthority.com/2011/12/16/sql-server-2012-auditing-enhancement-on-audit-log-failure-options-maximum-rollover-files/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 01:30:44 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16357</guid>
		<description><![CDATA[Recently I was exploring SQL Server Audit and found something very interesting. I found two enhancements in the SQL Server 2008 Create Audit Screen. SQL Server 2012 Create Audit Screen SQL Server 2008 Create Audit Screen On Audit Log Failure Options You can see that in SQL Server 2012 they have added two more options [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16357&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently I was exploring SQL Server Audit and found something very interesting. I found two enhancements in the SQL Server 2008 Create Audit Screen.</p>
<h3 style="text-align:justify;">SQL Server 2012 Create Audit Screen</h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/audit2012.jpg" alt="" width="500" height="532" /></p>
<h3 style="text-align:justify;">SQL Server 2008 Create Audit Screen</h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/audit2008.jpg" alt="" width="500" height="530" /></p>
<h3 style="text-align:justify;">On Audit Log Failure Options</h3>
<p style="text-align:justify;">You can see that in SQL Server 2012 they have added two more options for audit log failure. In earlier version the only option was to shut down the server when there was audit log failure. Now you can fail the operation as well continue on log failure. This new options now give finer control on the behavior of the audit failure scenario.When target is not available due to any reason and audit cannot log the event, it can be now continued, in another word the audit continues to attempt to log events and will resume if the failure condition is resolved. This is very important feature because earlier when Audio was failing the option which we had was to shutdown the server. There were the cases when shutting down the server is not the good option but continuing the business operation is the priority, this option should be exercised. Additionally, note that the new default value is now CONTINUE. User has option to select Fail Operation where the Audit will not attempt when the target is available or continuing auditing is possible.</p>
<h3 style="text-align:justify;">Maximum Rollover Files</h3>
<p style="text-align:justify;">Earlier, there were two options &#8211; have infinite number of log files or roll over the files after fixed number. Now in SQL Server 2012 there is option to keep the fixed number of the files along with no roll-over. This gives additional control to user when they want to save every single data and do not want to lose any critical information due to rollover.</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 />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/16357/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/16357/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/16357/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16357&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/12/16/sql-server-2012-auditing-enhancement-on-audit-log-failure-options-maximum-rollover-files/feed/</wfw:commentRss>
		<slash:comments>0</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/audit2012.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/audit2008.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; &#8216;Denali&#8217; &#8211; A Simple Example of Contained Databases</title>
		<link>http://blog.sqlauthority.com/2011/03/31/sql-server-denali-a-simple-example-of-contained-databases/</link>
		<comments>http://blog.sqlauthority.com/2011/03/31/sql-server-denali-a-simple-example-of-contained-databases/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 01:30:16 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=12412</guid>
		<description><![CDATA[Recently I was asked with the question: What is new for Database Security in SQL Server &#8220;Denali&#8221;? I think this is a very interesting question as I always wanted to talk about Contained Database, and this question gives me the chance to do so. Let us start with discussing contained database. A Contained Database is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12412&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently I was asked with the question: <strong><em>What is new for Database Security in SQL Server &#8220;Denali&#8221;?</em></strong></p>
<p style="text-align:justify;">I think this is a very interesting question as I always wanted to talk about Contained Database, and this question gives me the chance to do so. Let us start with discussing contained database.</p>
<p style="text-align:justify;">A Contained Database is a database which contains all the necessary settings and metadata, making database easily portable to another server. This database will contain all the necessary details and will not have to depend on any server where it is installed for anything. You can take this database and move it to another server without having any worries.</p>
<p style="text-align:justify;">The real question is, “What about users who are connecting to this database?” Once the contained database is moved, the users are moved as well, and users who belong to the contained database will have no access outside the contained database.</p>
<p style="text-align:justify;">In <em>summary, <strong>&#8220;Database is now self-contained. Database which is ’contained’ will not depend on anything on the server where it is installed.&#8221;</strong></em></p>
<p style="text-align:justify;">Let us try out this feature on SQL Server Denali. We will do the following steps:</p>
<ol style="text-align:justify;">
<li>Enable Contained Database</li>
<li>Create Contained Database</li>
<li>Create User in Contained Database</li>
<li>Try if the user can access outside      Contained Database</li>
</ol>
<p style="text-align:justify;">We can do various tests on this subject; however, in this blog post we will limit out exercise to the above four points.</p>
<h2 style="text-align:justify;">Enable Contained Database</h2>
<p style="text-align:justify;">Run the following code on SQL Server Denali. This code will enable the settings for the contained database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:darkred;">sp_configure </span><span style="color:red;">'show advanced options'</span><span style="color:gray;">,</span><span style="color:black;">1<br />
GO<br />
</span><span style="color:blue;">RECONFIGURE WITH </span><span style="color:black;">OVERRIDE<br />
GO<br />
</span><span style="color:darkred;">sp_configure </span><span style="color:red;">'contained database authentication'</span><span style="color:gray;">, </span><span style="color:black;">1<br />
GO<br />
</span><span style="color:blue;">RECONFIGURE WITH </span><span style="color:black;">OVERRIDE<br />
GO</span></code></p>
<h2 style="text-align:justify;">Create Contained Database</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">[ContainedDatabase]<br />
CONTAINMENT </span><span style="color:blue;">= </span><span style="color:black;">PARTIAL<br />
</span><span style="color:blue;">ON PRIMARY<br />
</span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'ContainedDatabase'</span><span style="color:gray;">, </span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\ContainedDatabase.mdf'</span><span style="color:gray;">)<br />
</span><span style="color:magenta;">LOG </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'ContainedDatabase_log'</span><span style="color:gray;">, </span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\ContainedDatabase_log.ldf'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span></code></p>
<h2 style="text-align:justify;">Create User in Contained Database</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[ContainedDatabase]<br />
GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:magenta;">USER </span><span style="color:black;">ContainedUser<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">PASSWORD </span><span style="color:blue;">= </span><span style="color:red;">'pass@word'</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code></p>
<h2 style="text-align:justify;">Try if this user can access out side Contained Database</h2>
<p style="text-align:justify;">To test this, we will attempt to login in the database with default settings (where login database is the master).</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/contained1.jpg" alt="" width="426" height="321" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/contained2.jpg" alt="" width="426" height="500" /></p>
<p style="text-align:justify;">When we attempt this, we will be not able to login in the server simply because the user does not exist at the server level.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/contained3.jpg" alt="" width="490" height="128" /></p>
<p style="text-align:justify;">Now, let us try to login in the system using the username which was created in the Contained Database.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/contained4.jpg" alt="" width="426" height="500" /></p>
<p style="text-align:justify;">You will notice that the login would be successful in the server. When expanded it, the user will have access to the contained database only, and not to any other database.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/contained5.jpg" alt="" width="433" height="337" /></p>
<p style="text-align:justify;">We will tackle more about this interesting subject in the future.</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 />Filed under: <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/12412/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/12412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/12412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12412&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/03/31/sql-server-denali-a-simple-example-of-contained-databases/feed/</wfw:commentRss>
		<slash:comments>10</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/contained1.jpg" medium="image" />

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

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

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

		<media:content url="http://www.pinaldave.com/bimg/contained5.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Securing TRUNCATE Permissions in SQL Server</title>
		<link>http://blog.sqlauthority.com/2010/12/20/sql-server-securing-truncate-permissions-in-sql-server/</link>
		<comments>http://blog.sqlauthority.com/2010/12/20/sql-server-securing-truncate-permissions-in-sql-server/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 01:30:28 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[Readers Question]]></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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11239</guid>
		<description><![CDATA[Download the Script of this article from here. On December 11, 2010, Vinod Kumar, a Databases &#38; BI technology evangelist from Microsoft Corporation, graced Ahmedabad by spending some time with the Community during the Community Tech Days (CTD) event. As he was running through a few demos, Vinod asked the audience one of the most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11239&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Download the Script of this article from <strong><a href="http://www.pinaldave.com/bimg/truncate.zip">here</a></strong>.</p>
<p style="text-align:justify;">On December 11, 2010, <strong><a href="http://blogs.sqlxml.org/vinodkumar/">Vinod Kumar</a></strong>, a Databases &amp; BI technology  evangelist from Microsoft Corporation, graced Ahmedabad by spending some  time with the Community during the<strong><a href="http://blog.sqlauthority.com/2010/12/17/sqlauthority-news-a-successful-community-techdays-at-ahmedabad-december-11-2010/" target="_blank"> Community Tech Days (CTD)</a></strong> event. As  he was running through a few demos, Vinod asked the audience one of the  most fundamental and common interview questions &#8211; &#8220;<strong><em>What is the  difference between a DELETE and TRUNCATE?</em></strong>&#8220;</p>
<p style="text-align:justify;">Ahmedabad SQL Server User Group Expert <strong>Nakul Vachhrajani</strong> has come up with excellent solutions of the same. I must congratulate Nakul for this excellent solution and as a encouragement to User Group member, I am publishing the same article over here.</p>
<p style="text-align:justify;"><img class="alignleft" style="margin:2px;" src="http://www.pinaldave.com/bimg/Nakul-Vachhrajani.jpg" alt="" width="250" height="226" /><strong>Nakul Vachhrajani</strong> is a Software Specialist and systems development professional with Patni Computer Systems Limited. He has functional experience spanning legacy code deprecation, system design, documentation, development, implementation, testing, maintenance and support of complex systems, providing business intelligence solutions, database administration, performance tuning, optimization, product management, release engineering, process definition and implementation. He has comprehensive grasp on Database Administration, Development and Implementation with MS SQL Server and C, C++, Visual C++/C#. He has about 6 years of total experience in information technology. Nakul is an member of the Ahmedabad and Gandhinagar SQL Server User Groups, and actively contributes to the community by actively participating in multiple forums and websites like <em><strong>SQLAuthority.com, BeyondRelational.com, SQLServerCentral.com</strong></em> and many others.</p>
<p style="text-align:justify;"><em>Please note:  The opinions expressed herein are Nakul own personal opinions and do not represent his employer&#8217;s view in anyway.</em></p>
<p style="text-align:justify;">All data from everywhere here on Earth go through a series of  four distinct operations, identified by the words: <strong>CREATE, READ, UPDATE and DELETE, </strong>or simply<strong>, CRUD.</strong> Putting in Microsoft SQL Server terms, is the process goes like this: INSERT, SELECT, UPDATE and DELETE/TRUNCATE.</p>
<p style="text-align:justify;">Quite a few interesting responses were received and evaluated live during the session. To summarize them, the most important similarity that came out was that both DELETE and TRUNCATE participate in transactions. The major differences (not all) that came out of the exercise were:</p>
<p style="text-align:justify;"><strong>DELETE:</strong></p>
<p style="text-align:justify;">DELETE supports a WHERE clause<br />
DELETE removes rows from a table, row-by-row<br />
Because DELETE moves row-by-row, it acquires a row-level lock<br />
Depending upon the recovery model of the database, DELETE is a fully-logged operation.<br />
Because DELETE moves row-by-row, it can fire off triggers</p>
<p style="text-align:justify;"><strong>TRUNCATE:</strong></p>
<p style="text-align:justify;">TRUNCATE does not support a WHERE clause<br />
TRUNCATE works by directly removing the individual data pages of a table<br />
TRUNCATE directly occupies a table-level lock.<br />
(Because a lock is acquired, and because TRUNCATE can also participate in a transaction, it has to be a logged operation)<br />
TRUNCATE is, therefore, a minimally-logged operation; again, this depends upon the recovery model of the database<br />
Triggers are not fired when TRUNCATE is used (because individual row deletions are not logged)</p>
<p style="text-align:justify;">Finally, Vinod popped the big homework question that must be critically analyzed:</p>
<p style="text-align:justify;"><strong>&#8220;We know that we can restrict a DELETE operation to a particular user, but how can we restrict the TRUNCATE operation to a particular user?” </strong></p>
<p style="text-align:justify;">After returning home and having a nice cup of coffee, I noticed that my gray cells immediately started to work. Below was the result of my research.</p>
<p style="text-align:justify;">As what is always said, the devil is in the details. Upon looking at the Permissions section for the TRUNCATE statement in Books On Line, the following jumps right out:</p>
<p style="text-align:justify;">&#8220;<em>The minimum permission required is <strong>ALTER</strong> on table_name. TRUNCATE TABLE permissions default to the table owner, members of the <strong>sysadmin</strong> fixed server role, and the <strong>db_owner</strong> and <strong>db_ddladmin</strong> fixed database roles, and are not transferable. However, you can incorporate the TRUNCATE TABLE statement within a module, such as a stored procedure, and grant appropriate permissions to the module using the EXECUTE AS clause.</em>&#8220;</p>
<p style="text-align:justify;">Now, what does this mean? Unlike DELETE, one cannot directly assign permissions to a user/set of users allowing or revoking TRUNCATE rights. However, there is a way to circumvent this. It is important to recall that in Microsoft SQL Server, database engine security surrounds the concept of a &#8220;securable&#8221;, which is any object like a table, stored procedure, trigger, etc. Rights are assigned to a principal on a securable. Refer to the image below (taken from the SQL Server Books On Line).</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions.jpg" alt="" width="463" height="600" /></p>
<p>urable&#8221;, which is any object like a table, stored procedure, trigger, etc. Rights are assigned to a principal on a securable. Refer to the image below (taken from the SQL Server Books On Line).</p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">SETTING UP THE ENVIRONMENT &#8211; (01A_Truncate Table Permissions.sql) </span><span style="color:#ff0000;">Script Provided at the end of the article.</span><span style="text-decoration:underline;"><br />
</span></strong></p>
<p style="text-align:justify;">By the end of this demo, one will be able to do all the CRUD operations, except the TRUNCATE, and the other will only be able to execute the TRUNCATE.</p>
<p style="text-align:justify;">All you will need for this test is any edition of SQL Server 2008. (With minor changes, these scripts can be made to work with SQL 2005.)</p>
<p style="text-align:justify;">We begin by creating the following:</p>
<p style="text-align:justify;">1.       A test database</p>
<p style="text-align:justify;">2.        Two database roles: associated logins and users</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions1.jpg" alt="" width="500" height="383" /></p>
<p style="text-align:justify;">3.       Switch over to the test database and create a test table. Then, add some data into it. I am using row constructors, which is new to SQL 2008.</p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">Creating the modules that will be used to enforce permissions</span></strong></p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;"> </span></strong></p>
<p style="text-align:justify;">1.       We have already created one of the modules that we will be assigning permissions to. That module is the table: TruncatePermissionsTest</p>
<p style="text-align:justify;">2.       We will now create two stored procedures; one is for the DELETE operation and the other for the TRUNCATE operation. Please note that for all practical purposes, the end result is the same &#8211; all data from the table TruncatePermissionsTest is removed</p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">Assigning the permissions</span></strong></p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;"> </span></strong></p>
<p style="text-align:justify;">Now comes the most important part of the demonstration &#8211; assigning permissions. A permissions matrix can be worked out as under:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions2.jpg" alt="" width="500" height="262" /></p>
<p style="text-align:justify;">To apply the security rights, we use the GRANT and DENY clauses, as under:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions3.jpg" alt="" width="500" height="339" /></p>
<p style="text-align:justify;">That&#8217;s it! We are now ready for our big test!</p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">THE TEST (01B_Truncate Table Test Queries.sql) </span></strong><span style="color:#ff0000;"><strong>Script Provided at the end of the article.</strong></span></p>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;"> </span></strong></p>
<p style="text-align:justify;">I will now need two separate SSMS connections, one with the login AllowedTruncate and the other with the login RestrictedTruncate.</p>
<p style="text-align:justify;">Running the test is simple; all that’s required is to run through the script &#8211; 01B_Truncate Table Test Queries.sql. What I will demonstrate here via screen-shots is the behavior of SQL Server when logged in as the AllowedTruncate user. There are a few other combinations than what are highlighted here. I will leave the reader the right to explore the behavior of the RestrictedTruncate user and these additional scenarios, as a form of self-study.</p>
<p style="text-align:justify;">1.       Testing SELECT permissions</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions4.jpg" alt="" width="500" height="221" /></p>
<p style="text-align:justify;">2.       Testing TRUNCATE permissions (Remember, &#8220;deny by default&#8221;?)</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions4.jpg" alt="" width="500" height="221" /></p>
<p style="text-align:justify;">3.       Trying to circumvent security by trying to TRUNCATE the table using the stored procedure</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/permissions6.jpg" alt="" width="500" height="79" /></p>
<p style="text-align:justify;">Hence, we have now proved that a user can indeed be assigned permissions to specifically assign TRUNCATE permissions. I also hope that the above has sparked curiosity towards putting some security around the probably &#8220;destructive&#8221; operations of DELETE and TRUNCATE.</p>
<p style="text-align:justify;">I would like to wish each and every one of the readers a very happy and secure time with Microsoft SQL Server.</p>
<p style="text-align:justify;"><em>(Please find the scripts &#8211; 01A_Truncate Table Permissions.sql and 01B_Truncate Table Test Queries.sql that have been used in this demonstration. Please note that these scripts contain purely test-level code only. These scripts must not, at any cost, be used in the reader&#8217;s production environments).</em></p>
<p style="text-align:justify;"><span style="color:#ff0000;"><strong>01A_Truncate Table Permissions.sql</strong></span></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/*<br />
*****************************************************************************************************************<br />
Developed By          : Nakul Vachhrajani<br />
Functionality         : This demo is focused on how to allow only TRUNCATE permissions to a particular user<br />
How to Use            : 1. Run through, step-by-step through the sequence till Step 08 to create a test database<br />
2. Switch over to the "Truncate Table Test Queries.sql" and execute it step-by-step<br />
in two different SSMS windows, one where you have logged in as 'RestrictedTruncate',<br />
and the other as 'AllowedTruncate'<br />
3. Come back to "Truncate Table Permissions.sql"<br />
4. Execute Step 10 to cleanup!<br />
Modifications         :<br />
December 13, 2010 - NAV - Updated to add a security matrix and improve code readability when applying security<br />
December 12, 2010 - NAV - Created<br />
*****************************************************************************************************************<br />
*/<br />
-- Step 01: Create a new test database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">TruncateTestDB<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">TruncateTestDB<br />
GO<br />
</span><span style="color:green;">-- Step 02: Add roles and users to demonstrate the security of the Truncate operation<br />
-- 2a. Create the new roles<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">ROLE AllowedTruncateRole</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">ROLE RestrictedTruncateRole</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- 2b. Create new logins<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">LOGIN AllowedTruncate </span><span style="color:blue;">WITH </span><span style="color:black;">PASSWORD </span><span style="color:blue;">= </span><span style="color:red;">'truncate@2010'</span><span style="color:gray;">,<br />
</span><span style="color:black;">CHECK_POLICY </span><span style="color:blue;">= ON<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">LOGIN RestrictedTruncate </span><span style="color:blue;">WITH </span><span style="color:black;">PASSWORD </span><span style="color:blue;">= </span><span style="color:red;">'truncate@2010'</span><span style="color:gray;">,<br />
</span><span style="color:black;">CHECK_POLICY </span><span style="color:blue;">= ON<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- 2c. Create new Users using the roles and logins created aboave<br />
</span><span style="color:blue;">CREATE </span><span style="color:magenta;">USER </span><span style="color:black;">TruncateUser </span><span style="color:blue;">FOR </span><span style="color:black;">LOGIN AllowedTruncate </span><span style="color:blue;">WITH </span><span style="color:black;">DEFAULT_SCHEMA </span><span style="color:blue;">= </span><span style="color:black;">dbo<br />
GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:magenta;">USER </span><span style="color:black;">NoTruncateUser </span><span style="color:blue;">FOR </span><span style="color:black;">LOGIN RestrictedTruncate </span><span style="color:blue;">WITH </span><span style="color:black;">DEFAULT_SCHEMA </span><span style="color:blue;">= </span><span style="color:black;">dbo<br />
GO<br />
</span><span style="color:green;">-- 2d. Add the newly created login to the newly created role<br />
</span><span style="color:darkred;">sp_addrolemember </span><span style="color:red;">'AllowedTruncateRole'</span><span style="color:gray;">,</span><span style="color:red;">'TruncateUser'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:darkred;">sp_addrolemember </span><span style="color:red;">'RestrictedTruncateRole'</span><span style="color:gray;">,</span><span style="color:red;">'NoTruncateUser'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Step 03: Change over to the test database<br />
</span><span style="color:blue;">USE </span><span style="color:black;">TruncateTestDB<br />
GO<br />
</span><span style="color:green;">-- Step 04: Create a test table within the test databse<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">TruncatePermissionsTest </span><span style="color:gray;">(</span><span style="color:black;">Id </span><span style="color:blue;">INT </span><span style="color:#434343;">IDENTITY</span><span style="color:gray;">(</span><span style="color:black;">1</span><span style="color:gray;">,</span><span style="color:black;">1</span><span style="color:gray;">),<br />
</span><span style="color:black;">Name </span><span style="color:blue;">NVARCHAR</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Step 05: Populate the required data<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TruncatePermissionsTest </span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:red;">N'Delhi'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Mumbai'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Ahmedabad'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Step 06: Encapsulate the DELETE within another module<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">proc_DeleteMyTable<br />
</span><span style="color:blue;">WITH EXECUTE AS </span><span style="color:black;">SELF<br />
</span><span style="color:blue;">AS DELETE FROM </span><span style="color:black;">TruncateTestDB..TruncatePermissionsTest<br />
GO<br />
</span><span style="color:green;">-- Step 07: Encapsulate the TRUNCATE within another module<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">proc_TruncateMyTable<br />
</span><span style="color:blue;">WITH EXECUTE AS </span><span style="color:black;">SELF<br />
</span><span style="color:blue;">AS TRUNCATE TABLE </span><span style="color:black;">TruncateTestDB..TruncatePermissionsTest<br />
GO<br />
</span><span style="color:green;">-- Step 08: Apply Security<br />
/*<br />
*****************************SECURITY MATRIX***************************************<br />
===================================================================================<br />
Object                   | Permissions |                 Login<br />
|             | AllowedTruncate   |   RestrictedTruncate<br />
|             |User:NoTruncateUser|   User:TruncateUser<br />
===================================================================================<br />
TruncatePermissionsTest  | SELECT,     |      GRANT        |      (Default)<br />
| INSERT,     |                   |<br />
| UPDATE,     |                   |<br />
| DELETE      |                   |<br />
-------------------------+-------------+-------------------+-----------------------<br />
TruncatePermissionsTest  | ALTER       |      DENY         |      (Default)<br />
-------------------------+-------------+----*/----------------+-----------------------<br />
</span><span style="color:black;">proc_DeleteMyTable </span><span style="color:gray;">| </span><span style="color:blue;">EXECUTE </span><span style="color:gray;">| </span><span style="color:blue;">GRANT </span><span style="color:gray;">| </span><span style="color:blue;">DENY<br />
</span><span style="color:green;">-------------------------+-------------+-------------------+-----------------------<br />
</span><span style="color:black;">proc_TruncateMyTable </span><span style="color:gray;">| </span><span style="color:blue;">EXECUTE </span><span style="color:gray;">| </span><span style="color:blue;">DENY </span><span style="color:gray;">| </span><span style="color:blue;">GRANT<br />
</span><span style="color:green;">-------------------------+-------------+-------------------+-----------------------<br />
</span><span style="color:gray;">*****************************</span><span style="color:black;">SECURITY MATRIX</span><span style="color:gray;">***************************************<br />
</span><span style="color:green;">*/<br />
/* Table: TruncatePermissionsTest*/<br />
</span><span style="color:blue;">GRANT SELECT</span><span style="color:gray;">, </span><span style="color:blue;">INSERT</span><span style="color:gray;">, </span><span style="color:blue;">UPDATE</span><span style="color:gray;">, </span><span style="color:blue;">DELETE ON </span><span style="color:black;">TruncateTestDB..TruncatePermissionsTest<br />
</span><span style="color:blue;">TO </span><span style="color:black;">NoTruncateUser<br />
GO<br />
</span><span style="color:blue;">DENY ALTER ON </span><span style="color:black;">TruncateTestDB..TruncatePermissionsTest<br />
</span><span style="color:blue;">TO </span><span style="color:black;">NoTruncateUser<br />
GO<br />
</span><span style="color:green;">/* Procedure: proc_DeleteMyTable*/<br />
</span><span style="color:blue;">GRANT EXECUTE ON </span><span style="color:black;">TruncateTestDB..proc_DeleteMyTable<br />
</span><span style="color:blue;">TO </span><span style="color:black;">NoTruncateUser<br />
GO<br />
</span><span style="color:blue;">DENY EXECUTE ON </span><span style="color:black;">TruncateTestDB..proc_DeleteMyTable<br />
</span><span style="color:blue;">TO </span><span style="color:black;">TruncateUser<br />
GO<br />
</span><span style="color:green;">/* Procedure: proc_TruncateMyTable*/<br />
</span><span style="color:blue;">DENY EXECUTE ON </span><span style="color:black;">TruncateTestDB..proc_TruncateMyTable<br />
</span><span style="color:blue;">TO </span><span style="color:black;">NoTruncateUser<br />
GO<br />
</span><span style="color:blue;">GRANT EXECUTE ON </span><span style="color:black;">TruncateTestDB..proc_TruncateMyTable<br />
</span><span style="color:blue;">TO </span><span style="color:black;">TruncateUser<br />
GO<br />
</span><span style="color:green;">-- Step 09: Test<br />
--Switch over to the "Truncate Table Test Queries.sql" and execute it step-by-step in two different SSMS windows:<br />
--    1. one where you have logged in as 'RestrictedTruncate', and<br />
--    2. the other as 'AllowedTruncate'<br />
-- Step 10: Cleanup<br />
</span><span style="color:darkred;">sp_droprolemember </span><span style="color:red;">'AllowedTruncateRole'</span><span style="color:gray;">,</span><span style="color:red;">'TruncateUser'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:darkred;">sp_droprolemember </span><span style="color:red;">'RestrictedTruncateRole'</span><span style="color:gray;">,</span><span style="color:red;">'NoTruncateUser'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">DROP </span><span style="color:magenta;">USER </span><span style="color:black;">TruncateUser<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:magenta;">USER </span><span style="color:black;">NoTruncateUser<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">LOGIN AllowedTruncate<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">LOGIN RestrictedTruncate<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">ROLE AllowedTruncateRole<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">ROLE RestrictedTruncateRole<br />
GO<br />
</span><span style="color:blue;">USE MASTER<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">TruncateTestDB<br />
GO</span></code></p>
<p style="text-align:justify;"><span style="color:#ff0000;"><strong>01B_Truncate Table Test Queries.sql</strong></span></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/*<br />
*****************************************************************************************************************<br />
Developed By          : Nakul Vachhrajani<br />
Functionality         : This demo is focused on how to allow only TRUNCATE permissions to a particular user<br />
How to Use            : 1. Switch over to this from "Truncate Table Permissions.sql", Step #09<br />
2. Execute this step-by-step in two different SSMS windows<br />
a. One where you have logged in as 'RestrictedTruncate', and<br />
b. The other as 'AllowedTruncate'<br />
3. Return back to "Truncate Table Permissions.sql"<br />
4. Execute Step 10 to cleanup!<br />
Modifications         :<br />
December 12, 2010 - NAV - Created<br />
*****************************************************************************************************************<br />
*/<br />
-- Step 09A: Switch to the test database<br />
</span><span style="color:blue;">USE </span><span style="color:black;">TruncateTestDB<br />
GO<br />
</span><span style="color:green;">-- Step 09B: Ensure that we have valid data<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">TruncatePermissionsTest<br />
GO<br />
</span><span style="color:green;">-- (Expected: Following error will occur if logged in as "AllowedTruncate")<br />
-- Msg 229, Level 14, State 5, Line 1<br />
-- The SELECT permission was denied on the object 'TruncatePermissionsTest', database 'TruncateTestDB', schema 'dbo'.<br />
--Step 09C: Attempt to Truncate Data from the table without using the stored procedure<br />
</span><span style="color:blue;">TRUNCATE TABLE </span><span style="color:black;">TruncatePermissionsTest<br />
GO<br />
</span><span style="color:green;">-- (Expected: Following error will occur)<br />
--  Msg 1088, Level 16, State 7, Line 2<br />
--  Cannot find the object "TruncatePermissionsTest" because it does not exist or you do not have permissions.<br />
-- Step 09D:Regenerate Test Data<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TruncatePermissionsTest </span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:red;">N'London'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Paris'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Berlin'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- (Expected: Following error will occur if logged in as "AllowedTruncate")<br />
-- Msg 229, Level 14, State 5, Line 1<br />
-- The INSERT permission was denied on the object 'TruncatePermissionsTest', database 'TruncateTestDB', schema 'dbo'.<br />
--Step 09E: Attempt to Truncate Data from the table using the stored procedure<br />
</span><span style="color:blue;">EXEC </span><span style="color:black;">proc_TruncateMyTable<br />
GO<br />
</span><span style="color:green;">-- (Expected: Will execute successfully with 'AllowedTruncate' user, will error out as under with 'RestrictedTruncate')<br />
-- Msg 229, Level 14, State 5, Procedure proc_TruncateMyTable, Line 1<br />
-- The EXECUTE permission was denied on the object 'proc_TruncateMyTable', database 'TruncateTestDB', schema 'dbo'.<br />
-- Step 09F:Regenerate Test Data<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TruncatePermissionsTest </span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:red;">N'Madrid'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Rome'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Athens'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">--Step 09G: Attempt to Delete Data from the table without using the stored procedure<br />
</span><span style="color:blue;">DELETE FROM </span><span style="color:black;">TruncatePermissionsTest<br />
GO<br />
</span><span style="color:green;">-- (Expected: Following error will occur if logged in as "AllowedTruncate")<br />
-- Msg 229, Level 14, State 5, Line 2<br />
-- The DELETE permission was denied on the object 'TruncatePermissionsTest', database 'TruncateTestDB', schema 'dbo'.<br />
-- Step 09H:Regenerate Test Data<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TruncatePermissionsTest </span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:red;">N'Spain'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Italy'</span><span style="color:gray;">),<br />
(</span><span style="color:red;">N'Greece'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">--Step 09I: Attempt to Delete Data from the table using the stored procedure<br />
</span><span style="color:blue;">EXEC </span><span style="color:black;">proc_DeleteMyTable<br />
GO<br />
</span><span style="color:green;">-- (Expected: Following error will occur if logged in as "AllowedTruncate")<br />
-- Msg 229, Level 14, State 5, Procedure proc_DeleteMyTable, Line 1<br />
-- The EXECUTE permission was denied on the object 'proc_DeleteMyTable', database 'TruncateTestDB', schema 'dbo'.<br />
--Step 09J: Close this SSMS window and return back to "Truncate Table Permissions.sql"</span></code></p>
<p style="text-align:justify;">Thank you Nakul to take up the challenge and prove that Ahmedabad and Gandhinagar SQL Server User Group has talent to solve difficult problems.</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 />Filed under: <a href='http://blog.sqlauthority.com/category/best-practices/'>Best Practices</a>, <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-contribution/'>Readers Contribution</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/11239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/11239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/11239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11239&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/12/20/sql-server-securing-truncate-permissions-in-sql-server/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>

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

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

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

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

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

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

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

		<media:content url="http://www.pinaldave.com/bimg/permissions6.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Best Practices for DBA Before Taking Vacation</title>
		<link>http://blog.sqlauthority.com/2010/08/10/sql-server-best-practices-for-dba-before-taking-vacation/</link>
		<comments>http://blog.sqlauthority.com/2010/08/10/sql-server-best-practices-for-dba-before-taking-vacation/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 01:30:18 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=9795</guid>
		<description><![CDATA[This blog post is written in response to T-SQL Tuesday hosted by Jason Brimhall. Everybody wants to take a vacation. Who does not love vacation, anyway? However, it seems that it has been getting more and more difficult to take vacation recently. There are two reasons why a person is not able to enjoy his [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=9795&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This blog post is written in response to  <a href="http://jasonbrimhall.info/2010/08/03/t-sql-tuesday-009-beach-time/" target="_blank">T-SQL Tuesday</a> hosted by Jason Brimhall.</p>
<p style="text-align:justify;"><a href="http://jasonbrimhall.info/2010/08/03/t-sql-tuesday-009-beach-time/"><img class="alignleft" style="margin:5px;" src="http://www.pinaldave.com/bimg/TSQL2sDay.jpg" alt="" width="120" height="120" /></a></p>
<p style="text-align:justify;">Everybody wants to take a vacation. Who does not love vacation, anyway? However, it seems that it has been getting more and more difficult to take vacation recently. There are two reasons why a person is not able to enjoy his vacation. First is due to <strong>company policies </strong>(bad boss!), and second is your <strong>responsibilities</strong>. Well, I cannot guide you much about company policy issues simply because I cannot do something about it. I have a wonderful boss and I have been taking many vacations, doing a few things whenever I’m on vacations.</p>
<h2 style="text-align:justify;"><strong>Do not think about your Job!</strong></h2>
<p style="text-align:justify;">This is the most difficult task. A very usual scenario when one goes to vacation is that he continuously thinks about his job even though he is actually on vacation. Here are a few reasons regarding this dilemma:</p>
<ul style="text-align:justify;">
<li>He thinks that without him, the office      would not be able to function.</li>
<li>He thinks that without him, someone      else would do better on the job and so he would lose the title <strong>“the Superhero”.</strong></li>
<li>He would miss the <strong>gossips</strong> at work.</li>
<li>He is too comfortable in his job,      and doing anything else scares him, even taking vacation.</li>
</ul>
<p style="text-align:justify;">Relax! None of the above would happen. Organizations always function with or without you. It is not about you; in fact, it is <strong>never</strong> about you. If you take a vacation, stop thinking about work and everything else. Just think of how you would enjoy your vacation.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/vacation.jpg" alt="" width="501" height="334" /></p>
<h2 style="text-align:justify;"><strong>Handling Job responsibilities</strong></h2>
<p style="text-align:justify;">If you are a DBA, you’ll notice that sometimes it is very difficult to go out on vacation because there are so many critical tasks you are handling and you simply cannot leave them for vacation. I have faced this situation many times. I remember that time when I was on vacation; the Jr. Guy who is supposed to take over my job responsibility ended up calling me with issues or problems. In IT, we all know that we are not always able to talk on the phone and solve the problems. In fact, I always have to see the screen when I am advising or talking technical subject.</p>
<p style="text-align:justify;">After working for many years, I have finally figured out how to avoid this kind of situation. Here are things I like to do regarding this problem:</p>
<h2 style="text-align:justify;"><strong>No Super Hero!</strong></h2>
<p style="text-align:justify;">I never try to become the only man in the organization who knows everything because it does not work out that well. Job security is good, but overdoing things is not good as well. There are many problems that arise with a certain situation. I always teach the critical task to another person in my organization. I make sure that he knows it very well. In fact, even though I am present in the organization, I often ask him to take care of the situation for me. This way, I make sure there’s a person besides me who knows how to handle the critical task. Now, I do not worry about this at all when I am on vacation.</p>
<h2 style="text-align:justify;"><strong>Automation!</strong></h2>
<p style="text-align:justify;">Well, we are working on this actively. There are so many different tasks which can be automated, yet we have ignored all these years. Many times, the argument is very simple. For example, a machine is still a machine so we need to at least take a look before approving final changes. All of these are true but there is something more than that for sure. We do not want to go back to “start”,  as described in the futuristic movies like<strong> I, Robot</strong>. However, there are a few things we can automate and leave with the machine. When I automate any task which I used to do manually, I make sure that I check the data being passed to or from me. I make sure that the data passed is proper and valid, and there are enough checkpoints in the process. Although I double-check these checkpoints, I do promote automation. We are currently looking into <strong>Powershell</strong> to automate a few tasks. I will post a detailed article about this subject when we are done with examining it.</p>
<h2 style="text-align:justify;"><strong>Backup and Restore!</strong></h2>
<p style="text-align:justify;">This task is very straightforward. Before I go on vacation, I always take one full backup of all the settings, jobs, and database. I keep them in a safe location and inform the next person in-charge the where I placed them. I was once asked to return from vacation earlier because something very bad happened and no one remembered what the original setting of the system was before it went down. This kind of the note can be useful during such cases.</p>
<h2 style="text-align:justify;"><strong>Document, and Document it Again!</strong></h2>
<p style="text-align:justify;">Well, let us assume you have explained everything to the next person in-charge and he has understood everything you wanted to explain. Then you went to vacation and something bad really happened, and he forgot what you have explained. Well this happens and, in fact, the guy who claims he has a sharp memory faces this issue the most. I keep it very standard; I always write down all the procedures and send an email to the person in-charge. There is a good probability that he will not remember your instructions, but he will surely remember when he reads your email or document.</p>
<h2 style="text-align:justify;"><strong>Keep the phone on!</strong></h2>
<p style="text-align:justify;">I think this can be an issue when one goes for vacation. I have seen many of my friends turning off their phones or pagers when they go on a vacation. Their argument is: “Well, it is vacation and this how it’s supposed to be.” However, I do the absolute opposite. I like to keep my phone on. This way, you will still know what happens when you’re not at work, plus, you would know a bit of what’s happening in your friends’ and relatives’ lives. This is the same thing for me. When I am on vacation, I like to keep things updated with what’s going on at work. I check my work email once a day and keep my phone on in case of emergency. I politely say <strong>“No”</strong> when I think I do not want to attend something and so far, I have never faced any problem with that. My co-worker and boss is very nice to me and I have never received any interruption in my vacation, unless it is so urgent that someone is dying.</p>
<p style="text-align:justify;">There are many things to do on this subject, but these are what I usually do.</p>
<p style="text-align:justify;">Let me know your idea about going on vacation!</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 />Filed under: <a href='http://blog.sqlauthority.com/category/best-practices/'>Best Practices</a>, <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/9795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/9795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/9795/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=9795&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/08/10/sql-server-best-practices-for-dba-before-taking-vacation/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/TSQL2sDay.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/vacation.jpg" medium="image" />
	</item>
		<item>
		<title>SQLAuthority News &#8211; Wireless Router Security and Attached Devices &#8211; Complex Password</title>
		<link>http://blog.sqlauthority.com/2010/05/06/sqlauthority-news-wireless-router-security-and-attached-devices-complex-password/</link>
		<comments>http://blog.sqlauthority.com/2010/05/06/sqlauthority-news-wireless-router-security-and-attached-devices-complex-password/#comments</comments>
		<pubDate>Thu, 06 May 2010 01:30:08 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8719</guid>
		<description><![CDATA[In the last week, I have received calls from friends who told me that they have got strange emails from me. To my surprise, I did not send them any emails. I was not worried until my wife complained that she was not able to find one of the very important folders containing our daughter&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8719&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">In the last week, I have received calls from friends who told me that they have got strange emails from me. To my surprise, I did not send them any emails. I was not worried until my wife complained that she was not able to find one of the very important folders containing our daughter&#8217;s photo that is located in our shared drive. This was alarming in my par, so I started a search around my computer’s folders. Again, please note that I am by no means a security expert. I checked my entire computer with virus and spyware, and strangely, there I found nothing. I tried to think what can cause this happening. I suddenly realized that there was a power outage in my area for about two hours during the days I have mentioned. Back then, my wireless router needed to be reset, and so I did. I had set up my WPA-PSK [TKIP] + WPA2-PSK [AES] very well. My key was very simple ( &#8216;SQLAuthority1&#8242;), and I never thought of changing it. (<strong><em>It is now replaced with a very complex one</em></strong>).</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/WPA.jpg" alt="" width="500" height="204" /></p>
<p style="text-align:justify;">While checking the Attached Devices, I found out that there was another very strange computer name and IP attached to my network. And so as soon as I found out that there is strange device attached to my computer, I shutdown my local network. Afterwards, I reconfigured my wireless router with a more complex security key. Since I created the complex password, I noticed that the user is no more connecting to my machine.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/attacheddevices.jpg" alt="" width="500" height="414" /></p>
<p style="text-align:justify;">Subsequently, I figured out that I can also set up Access Control List. I added my networked computer to that list as well. When I tried to connect from an external laptop which was not in the list but with a valid security key, I was not able to access the network, neither able to connect to it. I wasn’t also able to connect using a remote desktop, so I think it was good.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/accesslist.jpg" alt="" width="498" height="117" /></p>
<p style="text-align:justify;">If you have received any nasty emails from me (from my gmail account) during the afore-mentioned days, I want to apologize. I am already paying for my negligence of not putting a complex password; by way of losing the important photos of my daughter. I have already checked with my client, whose password I saved in SSMS, so there was no issue at all. In fact, I have decided to never leave any saved password of production server in my SSMS. Here is the tip <strong><a href="http://blog.sqlauthority.com/2008/11/05/sql-server-clear-drop-down-list-of-recent-connection-from-sql-server-management-studio/" target="_blank">SQL SERVER – Clear Drop Down List of Recent Connection From SQL Server Management Studio</a></strong> to clean them.</p>
<p style="text-align:justify;">I think after doing all this, I am feeling safe right now. However, I believe that safety is an illusion of many times. I need your help and advice if there is anymore I can do to stop unauthorized access.</p>
<p style="text-align:justify;">I am seeking advice and help through your comments.</p>
<p style="text-align:justify;">Update: Edited first line to remove dates.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://www.sqlauthority.com/" target="_blank">http://www.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-news/'>SQLAuthority News</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8719/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8719/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8719/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8719&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/05/06/sqlauthority-news-wireless-router-security-and-attached-devices-complex-password/feed/</wfw:commentRss>
		<slash:comments>11</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/WPA.jpg" medium="image" />

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

		<media:content url="http://www.pinaldave.com/bimg/accesslist.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Difference Between GRANT and WITH GRANT</title>
		<link>http://blog.sqlauthority.com/2010/04/03/sql-server-difference-between-grant-and-with-grant/</link>
		<comments>http://blog.sqlauthority.com/2010/04/03/sql-server-difference-between-grant-and-with-grant/#comments</comments>
		<pubDate>Sat, 03 Apr 2010 01:30:28 +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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Permissions]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8497</guid>
		<description><![CDATA[What is the difference between GRANT and WITH GRANT when giving permissions to the user? This is a very interesting question recently asked me to during my session at TechMela Nepal. Let us first see the syntax and analyze. GRANT: USE master; GRANT VIEW ANY DATABASE TO username; GO WITH GRANT: USE master; GRANT VIEW ANY DATABASE TO username [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8497&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><strong>What is the difference between GRANT and WITH GRANT when giving permissions to the user?</strong> This is a very interesting question recently asked me to during my session at <a href="http://blog.sqlauthority.com/2010/03/28/sqlauthority-news-author-visit-to-nepal-techmela-2-technical-sessions/" target="_blank">TechMela Nepal</a>.</p>
<p style="text-align:justify;">Let us first see the syntax and analyze.</p>
<p style="text-align:justify;">GRANT:<br />
<code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master</span><span style="color:gray;">;<br />
</span><span style="color:blue;">GRANT VIEW </span><span style="color:gray;">ANY </span><span style="color:blue;">DATABASE TO </span><span style="color:black;">username</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">WITH GRANT:<br />
<code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master</span><span style="color:gray;">;<br />
</span><span style="color:blue;">GRANT VIEW </span><span style="color:gray;">ANY </span><span style="color:blue;">DATABASE TO </span><span style="color:black;">username </span><span style="color:blue;">WITH GRANT OPTION</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span></code></p>
<p style="text-align:justify;">The difference between these options is very simple. In case of only GRANT, the username cannot grant the same permission to other users. On the other hand, with the option WITH GRANT, the username will be able to give the permission after receiving requests from other users.</p>
<p style="text-align:justify;">This is a very basic definition of the subject. I would like to request my readers to come up with a working script to prove this scenario. Please submit your script to me by email (pinal &#8216;at&#8217; sqlauthority.com), or in comment field.</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 />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/sql-permissions/'>SQL Permissions</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8497/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8497/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8497/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8497&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/04/03/sql-server-difference-between-grant-and-with-grant/feed/</wfw:commentRss>
		<slash:comments>8</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; Get the List of Object Dependencies &#8211; sp_depends and information_schema.routines and sys.dm_sql_referencing_entities</title>
		<link>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/</link>
		<comments>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 01:30:43 +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 Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL System Table]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7890</guid>
		<description><![CDATA[Recently, I read a question on my friend Ritesh Shah&#8216;s SQL site regarding the following: sp_depends does not give appropriate results whereas information_schema.routines does give proper answer. I have quite often seen that information_schema.routines gives proper dependency relationship where assp_depends returns an incorrect answer. However, as per book online sp_depends will be deprecated, and instead, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7890&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently, I read a question on my friend <a href="http://www.sqlhub.com/2010/01/spdepends-is-very-useful-stored.html" target="_blank">Ritesh Shah</a>&#8216;s SQL site regarding the following: sp_depends does not give appropriate results whereas information_schema.routines does give proper answer.</p>
<p style="text-align:justify;">I have quite often seen that information_schema.routines gives proper dependency relationship where assp_depends returns an incorrect answer. However, as per book online sp_depends will be deprecated, and instead, sys.dm_sql_referencing_entities and sys.dm_sql_referenced_entities are recommended.</p>
<p style="text-align:justify;">Let us quickly see where sp_depends fail and other solutions work fine.</p>
<p style="text-align:justify;">Let us first create two scenarios.</p>
<p style="text-align:justify;"><strong>Scenario 1: Normal Table Creation Order, where objects are created first and then used afterwords.</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">TempDB<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">dbo.TestTable<br />
</span><span style="color:gray;">( </span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">100</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- dbo.First is not created yet<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.Second<br />
</span><span style="color:blue;">AS<br />
EXEC </span><span style="color:black;">dbo.First<br />
GO<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.First<br />
</span><span style="color:blue;">AS<br />
SELECT </span><span style="color:black;">ID</span><span style="color:gray;">, </span><span style="color:black;">Name<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span></code></p>
<p style="text-align:justify;"><strong>Scenario 2: Objects are created afterwords and they are referenced first.</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">TempDB<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">dbo.TestTable<br />
</span><span style="color:gray;">( </span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">100</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.First<br />
</span><span style="color:blue;">AS<br />
SELECT </span><span style="color:black;">ID</span><span style="color:gray;">, </span><span style="color:black;">Name<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:green;">-- dbo.First is already created<br />
</span><span style="color:blue;">CREATE PROCEDURE </span><span style="color:black;">dbo.Second<br />
</span><span style="color:blue;">AS<br />
EXEC </span><span style="color:black;">dbo.First<br />
GO</span></code></p>
<p style="text-align:justify;">Now let us run following three queries on both the scenarios.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-- Method 1: Using sp_depends<br />
</span><span style="color:darkred;">sp_depends </span><span style="color:red;">'dbo.First'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Method 2: Using information_schema.routines<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">information_schema.routines ISR<br />
</span><span style="color:blue;">WHERE CHARINDEX</span><span style="color:gray;">(</span><span style="color:red;">'dbo.First'</span><span style="color:gray;">, </span><span style="color:black;">ISR.ROUTINE_DEFINITION</span><span style="color:gray;">) &gt; </span><span style="color:black;">0<br />
GO<br />
</span><span style="color:green;">-- Method 3: Using DMV sys.dm_sql_referencing_entities<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">referencing_schema_name</span><span style="color:gray;">, </span><span style="color:black;">referencing_entity_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">referencing_id</span><span style="color:gray;">, </span><span style="color:black;">referencing_class_desc</span><span style="color:gray;">, </span><span style="color:black;">is_caller_dependent<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_sql_referencing_entities </span><span style="color:gray;">(</span><span style="color:red;">'dbo.First'</span><span style="color:gray;">, </span><span style="color:red;">'OBJECT'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;"><strong>Result from Scenario 1</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sp_depends1.jpg" alt="" width="500" height="410" /></p>
<p style="text-align:justify;"><strong>Result from Scenario 2</strong></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sp_depends2.jpg" alt="" width="500" height="393" /></p>
<p style="text-align:justify;">It is clear that sp_depends does not give proper/correct results when the object creation order is different or following deferred name resolution.</p>
<p style="text-align:justify;">I suggest the use of the third method, in which sys.dm_sql_referencing_entities is used.</p>
<p style="text-align:justify;">Use the following script to get correct dependency:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">referencing_schema_name</span><span style="color:gray;">, </span><span style="color:black;">referencing_entity_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">referencing_id</span><span style="color:gray;">, </span><span style="color:black;">referencing_class_desc</span><span style="color:gray;">, </span><span style="color:black;">is_caller_dependent<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.dm_sql_referencing_entities </span><span style="color:gray;">(</span><span style="color:red;">'YourObject'</span><span style="color:gray;">, </span><span style="color:red;">'OBJECT'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Let me know the type of scripts you use for finding Object Dependencies. I will post your script with due credit.</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 />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/sql-security/'>SQL Security</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/sql-system-table/'>SQL System Table</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7890/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7890&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/02/04/sql-server-get-the-list-of-object-dependencies-sp_depends-and-information_schema-routines-and-sys-dm_sql_referencing_entities/feed/</wfw:commentRss>
		<slash:comments>31</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/sp_depends1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sp_depends2.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Fix: Error: 262 : SHOWPLAN permission denied in database</title>
		<link>http://blog.sqlauthority.com/2010/01/05/sql-server-fix-error-262-showplan-permission-denied-in-database/</link>
		<comments>http://blog.sqlauthority.com/2010/01/05/sql-server-fix-error-262-showplan-permission-denied-in-database/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 01:30:06 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></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 Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7919</guid>
		<description><![CDATA[During one of my recent training class when I asked students to check the execution plan using (can be enabled using CTRL+M), they received error as following. Msg 262, Level 14, State 4, Line 1 SHOWPLAN permission denied in database &#8216;AdventureWorks&#8217;. This is quite common that now all the developers have admin rights. It was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7919&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">During one of my recent training class when I asked students to check the execution plan using (can be enabled using CTRL+M), they received error as following.</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Msg 262, Level 14, State 4, Line 1<br />
SHOWPLAN permission denied in database &#8216;AdventureWorks&#8217;.</span></p>
<p style="text-align:justify;">This is quite common that now all the developers have admin rights. It was very easy to fix this issue.</p>
<p style="text-align:justify;"><strong>Fix Workaround:</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:blue;">GRANT </span><span style="color:black;">SHOWPLAN </span><span style="color:blue;">TO </span><span style="color:black;">UserName<br />
GO<br />
</span></code></p>
<p style="text-align:justify;">Just run above statement in the database where user is getting error and he will be able to see the query execution plan without any issue.</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, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7919/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7919&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/01/05/sql-server-fix-error-262-showplan-permission-denied-in-database/feed/</wfw:commentRss>
		<slash:comments>11</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; Database Encryption in SQL Server 2008 Enterprise Edition</title>
		<link>http://blog.sqlauthority.com/2009/10/03/sqlauthority-news-database-encryption-in-sql-server-2008-enterprise-edition/</link>
		<comments>http://blog.sqlauthority.com/2009/10/03/sqlauthority-news-database-encryption-in-sql-server-2008-enterprise-edition/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 01:30:36 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL White Papers]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server Encryption]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6973</guid>
		<description><![CDATA[Database Encryption in SQL Server 2008 Enterprise Edition SQL Server Technical Article Writers: Sung Hsueh Technical Reviewers: Raul Garcia, Sameer Tejani, Chas Jeffries, Douglas MacIver, Byron Hynes, Ruslan Ovechkin, Laurentiu Cristofor, Rick Byham, Sethu Kalavakur Published: February 2008 TDE does not replace cell-level encryption, EFS, or BitLocker. This white paper compares TDE with these other [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6973&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Database Encryption in SQL Server 2008 Enterprise Edition<br />
SQL Server Technical Article<br />
Writers: Sung Hsueh<br />
Technical Reviewers: Raul Garcia, Sameer Tejani, Chas Jeffries, Douglas MacIver, Byron Hynes, Ruslan Ovechkin, Laurentiu Cristofor, Rick Byham, Sethu Kalavakur<br />
Published: February 2008</p>
<p style="text-align:justify;">TDE does not replace cell-level encryption, EFS, or BitLocker. This white paper compares TDE with these other encryption methods for application developers and database administrators. While this is not a technical, in-depth review of TDE, technical implementations are explored and a familiarity with concepts such as virtual log files and the buffer pool are assumed. The user is assumed to be familiar with cell-level encryption and cryptography in general. Implementing database encryption is covered, but not the rationale for encrypting a database.</p>
<p><strong><a href="http://msdn.microsoft.com/en-us/library/cc278098.aspx" target="_blank">Read Database Encryption in SQL Server 2008 Enterprise Edition</a></strong></p>
<p>Abstract courtesy : Microsoft</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 />Posted in SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, SQL White Papers, SQLAuthority News, T SQL, Technology Tagged: SQL Server Encryption <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6973/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6973/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6973/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6973&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/10/03/sqlauthority-news-database-encryption-in-sql-server-2008-enterprise-edition/feed/</wfw:commentRss>
		<slash:comments>1</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; Cryptography in SQL Server 2008</title>
		<link>http://blog.sqlauthority.com/2009/09/15/sql-server-cryptography-in-sql-server-2008/</link>
		<comments>http://blog.sqlauthority.com/2009/09/15/sql-server-cryptography-in-sql-server-2008/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 01:30: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 Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6807</guid>
		<description><![CDATA[SQL Server, particularly the 2005 and 2008 versions, offers the functionality of cryptography. In the following, this functionality is briefly explained. Introduction Any database professional will support the encryption of data. However, the encryption of data has to be carried out at the database engine level. This is quite tricky as there the database performance [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6807&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">SQL Server, particularly the 2005 and 2008 versions, offers the functionality of cryptography. In the following, this functionality is briefly explained.</p>
<p style="text-align:justify;"><strong>Introduction</strong></p>
<p style="text-align:justify;">Any database professional will support the encryption of data. However, the encryption of data has to be carried out at the database engine level. This is quite tricky as there the database performance can be affected by the process of decryption, data manipulation, and then re-encryption when data is being updated. SQL Server offers robust data security. Further, it is important to have strong knowledge of cryptography in SQL Server in order to avoid many problems that are encountered by DBAs while implementing cryptography.</p>
<p style="text-align:justify;"><strong>SQL Server Authentication</strong></p>
<p style="text-align:justify;">When users log in to the database, there are two major steps of identifying the user: <em>authentication</em> and <em>authorization</em> (permissions).</p>
<ul style="text-align:justify;">
<li>Authentication implies the verification of user’s identity or the <em>security principal</em>. Encryption and signature play an important role in the authentication process.</li>
<li>Authorizations (also known as permissions) are the rights granted to a particular user. Permissions to a signature in SQL Server.</li>
</ul>
<p style="text-align:justify;"><strong>Protection of SQL Server Data by Encryption</strong></p>
<p style="text-align:justify;">At times, one can adequately protect data by controlling access to a table by using SQL Server robust permissions architecture. Therefore, what is the necessity of encrypting data on the server.</p>
<p style="text-align:justify;">In general, if the storage medium such as SAN and backup tapes is completely secure, it is not necessary to encrypt data. If an attacker can break the permissions architecture, then he/she can possibly access the encryption keys of your database with very little effort. In such case, encryption cannot help.</p>
<p style="text-align:justify;">However, if an attacker wants to access the file system, encryption defends the system to a greater depth.</p>
<p style="text-align:justify;">Encryption is necessary for the data that fall in the following categories:</p>
<ul style="text-align:justify;">
<li>For vulnerable storage media, wherein there are chances of loosing the backup data from PC or tapes.</li>
<li>In some cases, the data has to be protected from sysadmins. In such an instance, it is advisable to use the middle tier to perform encryption and decryption, rather than SQL server internal encryption. However, if the keys are stored in the SQL Server, it is almost impossible to protect the data from a sysadmin who is determined to find the keys.</li>
<li>If a sets of records (rows) within the same table needs to be protected, then users with cryptographic keys can be allowed to access the specific records, but not the other records within the same table. Encryption makes this process of hiding rows easy. In the case of regulating the permissions to columns, permissions on views can be enforced.</li>
<li>Highly sensitive data requires encryption for storage. Such data include information on credit cards and military projects.</li>
</ul>
<p style="text-align:justify;">Third-party backup options that enable the encryption of backup files can be considered in situations wherein offsite tape storage is less secure and the disk storage access is secure.</p>
<p style="text-align:justify;"><strong>Conclusion</strong></p>
<p style="text-align:justify;">The cryptographic functionality of SQL Sever has to deal with problems that were not taken into consideration during its design. Some common examples are as follows:</p>
<ul style="text-align:justify;">
<li>The use of asymmetric key pairs in cases where key communication is not a crucial issue; for example, when data is stored in the SQL Server database.</li>
<li>SQL Server permissions are sufficient to control access to data, except in situations where the access to the storage media is compromised. In such case, the security via encryption stands unnecessary.</li>
</ul>
<p style="text-align:justify;">Importantly, by using the cryptographic functionality of SQL Server, it is easy to create robust security. The native functionality offers access control and key storage, and the built-in encryption functionality offers robust security (including random salt and authenticator values). The ease in implementation of this functionality makes it an attractive choice for all types of users.</p>
<p style="text-align:justify;"><strong>Reference: </strong><strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>), </strong>White paper by <a href="http://msdn.microsoft.com/en-us/library/cc837966.aspx" target="_blank">John Hicks</a>, Microsoft Industry Solutions Group</p>
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6807/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6807/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6807&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/09/15/sql-server-cryptography-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>2</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; FIX : ERROR : Cannot open database requested by the login. The login failed. Login failed for user &#8216;NT AUTHORITY\NETWORK SERVICE&#8217;.</title>
		<link>http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/</link>
		<comments>http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 01:30:47 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></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 Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Login]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6622</guid>
		<description><![CDATA[This error is quite common and I have received it few times while I was working on a recent consultation project. Cannot open database requested by the login. The login failed. Login failed for user &#8216;NT AUTHORITY\NETWORK SERVICE&#8217;. This error occurs when you have configured your application with IIS, and IIS goes to SQL Server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6622&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This error is quite common and I have received it few times while I was working on a recent consultation project.</p>
<p style="text-align:justify;"><em><span style="color:#ff0000;">Cannot open database requested by the login. The login failed.<br />
Login failed for user &#8216;NT AUTHORITY\NETWORK SERVICE&#8217;.</span></em>
</p>
<p style="text-align:justify;">This error occurs when you have configured your application with IIS, and IIS goes to SQL Server and tries to login with credentials that do not have proper permissions. This error can also occur when replication or mirroring is set up.</p>
<p style="text-align:justify;">If you search online, there are many different solutions provided to solve this error, and many of these solutions work fine. However, I will be going over a solution that works always and is very simple.</p>
<p style="text-align:justify;"><strong>Fix/Workaround/Solution:</strong></p>
<p style="text-align:justify;">Go to SQL Server &gt;&gt; Security &gt;&gt; Logins and right click on NT AUTHORITY\NETWORK SERVICE and select Properties</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/errnt.jpg" alt="" width="468" height="439" /></p>
<p style="text-align:justify;">In newly opened screen of Login Properties, go to the “User Mapping” tab. Then, on the “User Mapping” tab, select the desired database – especially the database for which this error message is displayed. On the lower screen, check the role db_owner. Click OK.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/errnt1.jpg" alt="" width="500" height="451" /></p>
<p style="text-align:justify;">In almost all such cases, this should fix your problem.</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 />Posted in Pinal Dave, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Login <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6622/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6622/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6622/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6622&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/20/sql-server-fix-error-cannot-open-database-requested-by-the-login-the-login-failed-login-failed-for-user-nt-authoritynetwork-service/feed/</wfw:commentRss>
		<slash:comments>100</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/errnt.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/errnt1.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Reason for SQL Server Agent Starting Before SQL Server Engine Service</title>
		<link>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/</link>
		<comments>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 01:30:57 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server Agent]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6590</guid>
		<description><![CDATA[Nakul, a dedicated member of the Gandhinagar SQL Server User Group, recently emailed me with a very interesting, but quick question. He asked me why the SQL Server Agent starts before SQL Server Engine does? He made the very valid point that as the SQL Server Engine is the core service, it should start first, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6590&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Nakul, a dedicated member of the Gandhinagar SQL Server User Group, recently emailed me with a very interesting, but quick question. He asked me <em><strong>why the SQL Server Agent starts before SQL Server Engine does?</strong></em> He made the very valid point that as the SQL Server Engine is the core service, it should start first, and there is little point to running the SQL Server Agent without it.</p>
<p style="text-align:justify;">Off the top of my head, I can offer the following quick reasons for this sequence:</p>
<ul style="text-align:justify;">
<li>The SQL Server Engine does not only run jobs for SQL Server Engine itself. It also runs jobs for other core services like the SQL Server Analysis Service, Integration Service, Reporting Service etc.;</li>
<li>The SQL Server Agent can run almost any kind of task that an Operating system can run. For example invoking any program or running shell scripts;</li>
</ul>
<ul style="text-align:justify;">
<li>The SQL Server Agent also      starts jobs which are scheduled to run the second the SQL Server Engine      starts, and for this reason it is needed; and</li>
<li>Replication, mirroring and a few      other tasks also depend on Agent Jobs.</li>
</ul>
<p style="text-align:justify;">These are the reasons that I have come up with so far. Can you think of any more? Let us have your views.</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 />Posted in Database, Pinal Dave, Readers Question, SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Server Agent <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6590/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6590&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/13/sql-server-reason-for-sql-server-agent-starting-before-sql-server-engine-service/feed/</wfw:commentRss>
		<slash:comments>11</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; Forgot the Password of Username SA</title>
		<link>http://blog.sqlauthority.com/2009/08/04/sql-server-forgot-the-password-of-username-sa/</link>
		<comments>http://blog.sqlauthority.com/2009/08/04/sql-server-forgot-the-password-of-username-sa/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 01:30:24 +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 Server Management Studio]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[Username]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=6268</guid>
		<description><![CDATA[I just received a call from an old friend with whom I used to work in Las Vegas. He told me about a password-related issue he faced in his organization. They had changed the password of username SA and now they are not able to recall the new password. I am sure that he is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6268&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I just received a call from an old friend with whom I used to work in Las Vegas. He told me about a password-related issue he faced in his organization. They had changed the password of username SA and now they are not able to recall the new password. I am sure that he is not the first person who has faced this issue. There may be many more similar situations where employees who have sysamin password leaves the job or a hacker disables the SA account.</p>
<p style="text-align:justify;">Resetting the password of SA is a breeze!</p>
<p style="text-align:justify;"><strong>Option 1 :</strong></p>
<p style="text-align:justify;">If there is any other SQL Server Login that is a member of sysadmin role, you can log in using that account and reset the password of SQL Server. Change the password of SA account as described here :  <a href="http://blog.sqlauthority.com/2007/12/29/sql-server-change-password-of-sa-login-using-management-studio/" target="_blank">SQL SERVER – Change Password of SA Login Using Management Studio</a>.</p>
<p style="text-align:justify;"><strong>Option 2 :</strong></p>
<p style="text-align:justify;">If there is any other Windows Login that is a member of Windows Admin Group, log in using that account. Start SQL Server in Single User Mode as described here :  <a href="http://blog.sqlauthority.com/2009/02/10/sql-server-start-sql-server-instance-in-single-user-mode/" target="_blank">SQL SERVER – Start SQL Server Instance in Single User Mode</a>.<br />
Create a new login and give it sysadmin permission.
</p>
<p style="text-align:justify;">Note : If you have SQL Server Agent enabled, it starts before SQL Server service. If you have enabled SQL Server in a single user mode, it will connect it first, so it is recommended to turn that off before attempting any of the above options.</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 />Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Server Management Studio, SQL Tips and Tricks, T SQL, Technology Tagged: Password, Username <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/6268/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/6268/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/6268/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=6268&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/08/04/sql-server-forgot-the-password-of-username-sa/feed/</wfw:commentRss>
		<slash:comments>20</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; Policy-Based Management &#8211; Create, Evaluate and Fix Policies</title>
		<link>http://blog.sqlauthority.com/2009/06/30/sql-server-2008-policy-based-management-create-evaluate-and-fix-policies/</link>
		<comments>http://blog.sqlauthority.com/2009/06/30/sql-server-2008-policy-based-management-create-evaluate-and-fix-policies/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 01:30:44 +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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Policy Management]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5771</guid>
		<description><![CDATA[This article will cover the most spectacular feature of SQL 2008 &#8211; Policy-based management and how the configuration of SQL Server with policy-based management architecture can make a powerful difference. Policy based management is loaded with several advantages. It can help you implement various policies for reliable configuration of the system. It also provides additional [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5771&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This article will cover the most spectacular feature of SQL 2008 &#8211; Policy-based management and how the configuration of SQL Server with policy-based management architecture can make a powerful difference. Policy based management is loaded with several advantages. It can help you implement various policies for reliable configuration of the system. It also provides additional administration assistance to DBAs and helps them effortlessly manage various tasks of SQL Server across the enterprise.</p>
<p style="text-align:justify;">1 Introduction<br />
2 Basics of Policy Management<br />
3 Policy Management Terms<br />
4 Practical Example of Policy Management<br />
4.1 Exploring of Facets<br />
4.2 Create a Condition<br />
4.3 Create a Policy<br />
4.4 Evaluate a Policy<br />
4.5 Fix Non-complying Policy<br />
5 Summary</p>
<h3 style="text-align:justify;"><a href="http://dotnetslackers.com/articles/sql/Policy-Based-Management-Create-Evaluate-and-Fix-Policies.aspx" target="_blank">Read complete article here.</a></h3>
</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, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: Policy Management <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5771/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5771/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5771/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5771&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/30/sql-server-2008-policy-based-management-create-evaluate-and-fix-policies/feed/</wfw:commentRss>
		<slash:comments>2</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; Using SQL Server 2008 Extended Events &#8211; White paper By Jonathan Kehayias</title>
		<link>http://blog.sqlauthority.com/2009/06/07/sqlauthority-news-using-sql-server-2008-extended-events-white-paper-by-jonathan-kehayias/</link>
		<comments>http://blog.sqlauthority.com/2009/06/07/sqlauthority-news-using-sql-server-2008-extended-events-white-paper-by-jonathan-kehayias/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 01:30:23 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL White Papers]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5379</guid>
		<description><![CDATA[Strange it may sound but being a SQL Server pro has its downside too. Common information on SQL does not interest me, while a good document is hard to find. So the reader in me is mostly discontented and constantly keeps looking for interesting documents.  Recently, I chanced upon a really good white paper by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5379&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Strange it may sound but being a SQL Server pro has its downside too. Common information on SQL does not interest me, while a good document is hard to find. So the reader in me is mostly discontented and constantly keeps looking for interesting documents.  Recently, I chanced upon a really good white paper by <strong>Jonathan Keyhayias</strong> on SQL Serve r2008 extended events. I have known Jonathan through forums but have not met him in person yet. But I hope to meet him soon.</p>
<p style="text-align:justify;">The white paper starts with introduction to the extended event and then elaborates on its architecture, system objects, confusing target data and other important aspects of the extended events. This white paper ends with life of an event, and I would recommend that you read this portion at least if you do not have sufficient time to read the whole white paper.</p>
<p style="text-align:justify;">Let us go through the first paragraph taken from the white paper which lucidly defines extended events.</p>
<p style="text-align:justify;"><strong>What is extended events?</strong><br />
As SQL Server matures with time, the diagnostics tools available to administrators to troubleshoot problems when they arise have also matured. SQL Server 2000 had very limited diagnostic tools when compared with SQL Server 2005. SQL Trace and SQL Server Profiler were often the tools of choice for administrators to identify problems with performance, along with DBCC and individual trace flags like 1205 for deadlocks, and 3605 to log results to the SQL Server error log. With SQL Server 2005, the diagnostic tools expanded to include the dynamic management views, which provide a deep view into the internal workings of SQL Server, additional trace events for SQL Trace and SQL Server Profiler including the deadlock graph and Showplan XML events, the ability to import performance counter logs in SQL Server Profiler to view trace events along with their impact on the system, and WMI events which use Service Broker endpoints for event notifications. SQL Server 2008 continues to build upon the diagnostic tools with a new feature called Extended Events.</p>
<p style="text-align:justify;">You can continue reading the white paper <strong><a href="http://msdn.microsoft.com/en-us/library/dd822788.aspx" target="_blank">Using SQL Server 2008 Extended Events</a></strong> here.</p>
<p style="text-align:justify;">Let me have your views about this white paper.</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 SQL, SQL Authority, SQL Documentation, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, SQL White Papers, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5379/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5379/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5379/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5379&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/06/07/sqlauthority-news-using-sql-server-2008-extended-events-white-paper-by-jonathan-kehayias/feed/</wfw:commentRss>
		<slash:comments>0</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; Find Hostname and Current Logged In User Name</title>
		<link>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/</link>
		<comments>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/#comments</comments>
		<pubDate>Tue, 26 May 2009 01:30: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 Function]]></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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Username]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=5166</guid>
		<description><![CDATA[I work in an environment wherein I connect to multiple servers across the world. Time and again, my SSMS is connected to a myriad of servers that kindles a lot of confusion. I frequently use the following trick to separate different connections, which I mentioned in my blog sometime back SQL SERVER – 2008 – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5166&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I work in an environment wherein I connect to multiple servers across the world. Time and again, my SSMS is connected to a myriad of servers that kindles a lot of confusion. I frequently use the following trick to separate different connections, which I mentioned in my blog sometime back <strong><a href="http://blog.sqlauthority.com/2009/01/04/sql-server-2008-change-color-of-status-bar-of-ssms-query-editor/">SQL SERVER – 2008 – Change Color of Status Bar of SSMS Query Editor</a></strong>. However, this trick does not help when a huge number of different connections are open. In such a case, I use the following handy script. Do not go by the length of the script; it might be very short but always works great!</p>
<p style="text-align:justify;">Now, let’s take a look at the execution of this script in two different scenarios.</p>
<p style="text-align:justify;"><strong>1) Logged in using SQL Authentication</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">HOST_NAME</span><span style="color:gray;">() </span><span style="color:blue;">AS </span><span style="color:black;">HostName</span><span style="color:gray;">, </span><span style="color:black;">SUSER_NAME</span><span style="color:gray;">() </span><span style="color:black;">LoggedInUser</span></code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/loginsa.jpg" alt="" width="431" height="154" /></p>
<p style="text-align:justify;">
<p style="text-align:justify;"><strong>2) Logged in using Windows Authentication</strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">HOST_NAME</span><span style="color:gray;">() </span><span style="color:blue;">AS </span><span style="color:black;">HostName</span><span style="color:gray;">, </span><span style="color:black;">SUSER_NAME</span><span style="color:gray;">() </span><span style="color:black;">LoggedInUser</span></code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/loginwin.jpg" alt="" width="338" height="149" /></p>
<p style="text-align:justify;">
<p style="text-align:justify;">It is quite evident from both the above cases that we get correct logged-in username and hostname. Let me know if this script is helpful to you when you face a similar situation.</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, SQL, SQL Authority, SQL Function, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: Username <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/5166/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/5166/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/5166/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=5166&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/26/sql-server-find-hostname-and-current-logged-in-user-name/feed/</wfw:commentRss>
		<slash:comments>28</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/loginsa.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/loginwin.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX : ERROR :  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)</title>
		<link>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/</link>
		<comments>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 01:30:51 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Readers Question]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4760</guid>
		<description><![CDATA[Just a day ago, one of my friend sent me email requesting help with following error: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) In fact this is not SQL Server error but it is of .NET application. The solution of this error is just changing configuration of IIS7. Fix/Solution/Workaround: Go to IIS. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4760&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, one of my friend sent me email requesting help with following error:</p>
<p style="text-align:justify;"><span style="color:#ff0000;">is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)</span></p>
<p style="text-align:justify;">In fact this is not SQL Server error but it is of .NET application. The solution of this error is just changing configuration of IIS7.</p>
<p style="text-align:justify;"><strong>Fix/Solution/Workaround:</strong></p>
<p style="text-align:justify;">Go to IIS.<br />
Click on Application Pool.<br />
Look for your web application in application pool.<br />
Go to Advanced Settings by right clicking on previously selected application pool.<br />
Enable 32-Bit Applications by checking it.
</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 Security, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4760/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4760/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4760/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4760&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/30/sql-server-fix-error-is-not-a-valid-win32-application-exception-from-hresult-0x800700c1/feed/</wfw:commentRss>
		<slash:comments>1</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; Introduction to SQL Server Encryption and Symmetric Key Encryption Tutorial with Script</title>
		<link>http://blog.sqlauthority.com/2009/04/28/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/</link>
		<comments>http://blog.sqlauthority.com/2009/04/28/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 01:30:57 +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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server Encryption]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4481</guid>
		<description><![CDATA[SQL Server 2005 and SQL Server 2008 provide encryption as a new feature to protect data against hackers’ attacks. Hackers might be able to penetrate the database or tables, but owing to encryption they would not be able to understand the data or make use of it. Nowadays, it has become imperative to encrypt crucial [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4481&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">SQL Server 2005 and SQL Server 2008 provide encryption as a new feature to protect data against hackers’ attacks. Hackers might be able to penetrate the database or tables, but owing to encryption they would not be able to understand the data or make use of it. Nowadays, it has become imperative to encrypt crucial security-related data while storing in the database as well as during transmission across a network between the client and the server.</p>
<p style="text-align:justify;">Encryption hierarchy is marked by three-level security. These three levels provide different mechanisms for securing data across networks and local servers. Different levels of hierarchies allow multiple instances of services (e.g., SQL Server Services) to run on one physical server.</p>
<ul style="text-align:justify;">
<li><strong>Windows Level</strong> &#8211; Highest Level &#8211; Uses Windows DP API for encryption</li>
<li><strong>SQL Server Level </strong>- Moderate Level &#8211; Uses Services Master Key for encryption</li>
<li><strong>Database Level</strong> &#8211; Lower Level &#8211; Uses Database Master Key for encryption</li>
</ul>
<p style="text-align:justify;">There are two  kinds of keys used in encryption:</p>
<ul style="text-align:justify;">
<li><strong>Symmetric Key</strong> &#8211; In Symmetric cryptography system, the sender and the receiver of a message share a single, common key that is used to encrypt and decrypt the message. This is relatively easy to implement, and both the sender and the receiver can encrypt or decrypt the messages.</li>
<li> <strong>Asymmetric Key</strong> &#8211; Asymmetric cryptography, also known as Public-key cryptography, is a system in which the sender and the receiver of a message have a pair of cryptographic keys &#8211; a public key and a private key &#8211; to encrypt and decrypt the message. This is a relatively complex system where the sender can use his key to encrypt the message but he cannot decrypt it. The receiver, on the other hand, can use his key to decrypt the message but he cannot encrypt it. This intricacy has turned it into a resource-intensive process.</li>
</ul>
<p style="text-align:justify;">Yet another way to encrypt data is through certificates. A public key certificate is a digitally signed statement that binds the value of a public key to the identity of the person, device, or service that holds the corresponding private key. A Certification Authority (CA) issues and signs certifications. <strong><a href="http://www.pinaldave.com/sql-downloads/sql-downloads/script-downloads/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/" target="_blank">Download complete script here</a></strong>.</p>
<p style="text-align:justify;">Please create a sample database that we will be use for testing Encryption. There are two different kinds of encryptions available in SQL Server:</p>
<ul style="text-align:justify;">
<li><strong>Database Level</strong> &#8211; This level secures all the data in a database. However, every time data is written or read from database, the whole database needs to be decrypted. This is a very resource-intensive process and not a practical solution.</li>
<li><strong>Column (or Row) Level</strong> &#8211; This level of encryption is the most preferred method. Here, only columns containing important data should be encrypted; this will result in lower CPU load compared with the whole database level encryption. If a column is used as a primary key or used in comparison clauses (WHERE clauses, JOIN conditions) the database will have to decrypt the whole column to perform operations involving those columns.</li>
</ul>
<p style="text-align:justify;">Let&#8217;s go over a simple instance that demonstrates the encryption and the decryption process executed with Symmetric Key and Triple DES encryption algorithm.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Create Database  */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">EncryptTest<br />
</span><span style="color:blue;">ON PRIMARY </span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'EncryptTest'</span><span style="color:gray;">, </span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\EncryptTest.mdf'</span><span style="color:gray;">)<br />
</span><span style="color:magenta;">LOG </span><span style="color:blue;">ON </span><span style="color:gray;">( </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'EncryptTest_log'</span><span style="color:gray;">, </span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\EncryptTest_log.ldf'</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">First, let&#8217;s create a sample table and then populate it with sample data. We will now encrypt one of the two columns of the table.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Create table and insert data in the table */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">FirstCol </span><span style="color:blue;">INT</span><span style="color:gray;">, </span><span style="color:black;">SecondCol </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">))<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">FirstCol</span><span style="color:gray;">, </span><span style="color:black;">SecondCol</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">1</span><span style="color:gray;">,</span><span style="color:red;">'First'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">2</span><span style="color:gray;">,</span><span style="color:red;">'Second'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">3</span><span style="color:gray;">,</span><span style="color:red;">'Third'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">4</span><span style="color:gray;">,</span><span style="color:red;">'Fourth'<br />
</span><span style="color:blue;">UNION </span><span style="color:gray;">ALL<br />
</span><span style="color:blue;">SELECT </span><span style="color:black;">5</span><span style="color:gray;">,</span><span style="color:red;">'Fifth'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/* Check the content of the TestTable */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO</span></code></p>
<p style="text-align:justify;">The preceding code will return the result depicted in the subsequent figure.</p>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><img title="Result of the SQL query" src="http://www.pinaldave.com/bimg/SqlQueryResult1.gif" alt="" width="156" height="121" /></dt>
<dd class="wp-caption-dd">Result of the SQL query</dd>
</dl>
</div>
<p style="text-align:justify;">Every database can have one master key. Database master key is a symmetric key used to protect the private keys of certificates and asymmetric keys present in the database. It uses Triple DES algorithm together with user-provided password to encrypt the keys.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Create Database Master Key */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">MASTER </span><span style="color:blue;">KEY </span><span style="color:black;">ENCRYPTION<br />
</span><span style="color:blue;">BY </span><span style="color:black;">PASSWORD </span><span style="color:blue;">= </span><span style="color:red;">'SQLAuthority'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Certificates are used to safeguard encryption keys, which are used to encrypt data in the database. SQL Server 2005 has the capability to generate self-signed X.509 certificates.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Create Encryption Certificate */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">CERTIFICATE EncryptTestCert<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">SUBJECT </span><span style="color:blue;">= </span><span style="color:red;">'SQLAuthority'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">The symmetric key can be encrypted by using various options such as certificate, password, symmetric key, and asymmetric key. A number of different algorithms can be employed for encrypting key. The supported algorithms are DES, TRIPLE_DES, RC2, RC4, RC4_128, DESX, AES_128, AES_192, and AES_256.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Create Symmetric Key */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">CREATE </span><span style="color:black;">SYMMETRIC </span><span style="color:blue;">KEY </span><span style="color:black;">TestTableKey<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">ALGORITHM </span><span style="color:blue;">= </span><span style="color:black;">TRIPLE_DES ENCRYPTION<br />
</span><span style="color:blue;">BY </span><span style="color:black;">CERTIFICATE EncryptTestCert<br />
GO</span></code></p>
<p style="text-align:justify;">Now add a column of type varbinary to the original table, which will store the encrypted value for the SecondCol.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/*  Encrypt Data using Key and Certificate<br />
Add Columns which will hold the encrypted data in binary */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">ALTER TABLE </span><span style="color:black;">TestTable<br />
</span><span style="color:blue;">ADD </span><span style="color:black;">EncryptSecondCol VARBINARY</span><span style="color:gray;">(</span><span style="color:black;">256</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Before the key is used, it needs to be decrypted using the same method that was used for encrypting it. In our example, we have used a certificate for encrypting the key. Because of the same reason, we are using the same certificate for opening the key and making it available for use. Subsequent to opening it and making it available for use, we can use the encryptkey function and store the encrypted values in the database, in the EncryptSecondCol column.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* Update binary column with encrypted data created by certificate and key */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">OPEN </span><span style="color:black;">SYMMETRIC </span><span style="color:blue;">KEY </span><span style="color:black;">TestTableKey DECRYPTION<br />
</span><span style="color:blue;">BY </span><span style="color:black;">CERTIFICATE EncryptTestCert<br />
</span><span style="color:blue;">UPDATE </span><span style="color:black;">TestTable<br />
</span><span style="color:blue;">SET </span><span style="color:black;">EncryptSecondCol </span><span style="color:blue;">= </span><span style="color:black;">ENCRYPTBYKEY</span><span style="color:gray;">(</span><span style="color:black;">KEY_GUID</span><span style="color:gray;">(</span><span style="color:red;">'TestTableKey'</span><span style="color:gray;">),</span><span style="color:black;">SecondCol</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">We can drop the original SecondCol column, which we have now encrypted in the EncryptSecondCol column. If you do not want to drop the column, you can keep it for future comparison of the data when we decrypt the column.<br />
<code style="font-size:12px;"><span style="color:green;"><br />
/* DROP original column which was encrypted for protect the data */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">ALTER TABLE </span><span style="color:black;">TestTable<br />
</span><span style="color:blue;">DROP COLUMN </span><span style="color:black;">SecondCol<br />
GO</span></code></p>
<p style="text-align:justify;">We can run a SELECT query on our database and verify if our data in the table is well protected and hackers will not be able to make use of it even if they somehow manage to reach the data.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Check the content of the TestTable */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO</span></code></p>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><img title="Result of the previous SQL query" src="http://www.pinaldave.com/bimg/SqlQueryResult2.gif" alt="" width="417" height="118" /></dt>
<dd class="wp-caption-dd">Result of the previous SQL query</dd>
</dl>
</div>
<p style="text-align:justify;">Authorized user can use the decryptbykey function to retrieve the original data from the encrypted column. If Symmetric key is not open for decryption, it has to be decrypted using the same certificate that was used to encrypt it. An important point to bear in mind here is that the original column and the decrypted column should have the same data types. If their data types differ, incorrect values could be reproduced. In our case, we have used a VARCHAR data type for SecondCol and EncryptSecondCol.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Decrypt the data of the SecondCol  */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">OPEN </span><span style="color:black;">SYMMETRIC </span><span style="color:blue;">KEY </span><span style="color:black;">TestTableKey DECRYPTION<br />
</span><span style="color:blue;">BY </span><span style="color:black;">CERTIFICATE EncryptTestCert<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">CONVERT</span><span style="color:gray;">(</span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">),</span><span style="color:black;">DECRYPTBYKEY</span><span style="color:gray;">(</span><span style="color:black;">EncryptSecondCol</span><span style="color:gray;">)) </span><span style="color:blue;">AS </span><span style="color:black;">DecryptSecondCol<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO</span></code></p>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><img title="Result of the previous SQL query" src="http://www.pinaldave.com/bimg/SqlQueryResult3.gif" alt="" width="192" height="122" /></dt>
<dd class="wp-caption-dd">Result of the previous SQL query</dd>
</dl>
</div>
<p style="text-align:justify;">If you drop the database after the entire processing is complete, you do not have to worry about cleaning up the database. However, in real world on production servers, the database is not dropped. It is a good practice for developers to close the key after using it. If keys and certificates are used only once or their use is over, they can be dropped as well. Dropping a database will drop everything it contains &#8211; table, keys, certificates, all the data, to name a few.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* Clean up database  */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">EncryptTest<br />
GO<br />
</span><span style="color:blue;">CLOSE </span><span style="color:black;">SYMMETRIC </span><span style="color:blue;">KEY </span><span style="color:black;">TestTableKey<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">SYMMETRIC </span><span style="color:blue;">KEY </span><span style="color:black;">TestTableKey<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">CERTIFICATE EncryptTestCert<br />
GO<br />
</span><span style="color:blue;">DROP </span><span style="color:black;">MASTER </span><span style="color:blue;">KEY<br />
</span><span style="color:black;">GO<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;">[EncryptTest]<br />
GO</span></code></p>
<p style="text-align:justify;"><strong>Summary</strong></p>
<p style="text-align:justify;">Encryption is a very important security feature of SQL Server 2005. Long keys and asymmetric keys create unassailable, stronger encryption and stronger encryption uses lots of CPU to encrypt data. Stronger encryption is slower to process. When there is a huge amount of data to encrypt, it is suggested to encrypt it using a symmetric key. The same symmetric key can be encrypted further with an asymmetric key for additional protection, thereby adding the advantage of a stronger encryption. It is also recommended to compress data before encryption, as encrypted data cannot be compressed.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>),</strong><a href="http://dotnetslackers.com/articles/sql/IntroductionToSQLServerEncryptionAndSymmetricKeyEncryptionTutorial.aspx" target="_blank"> DotNetSlackers</a>,<strong><a href="http://www.pinaldave.com/sql-downloads/sql-downloads/script-downloads/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/" target="_blank">Download complete script here</a></strong></p>
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Server Encryption <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4481/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4481/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4481/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4481&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/28/sql-server-introduction-to-sql-server-encryption-and-symmetric-key-encryption-tutorial-with-script/feed/</wfw:commentRss>
		<slash:comments>59</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/SqlQueryResult1.gif" medium="image">
			<media:title type="html">Result of the SQL query</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/SqlQueryResult2.gif" medium="image">
			<media:title type="html">Result of the previous SQL query</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/SqlQueryResult3.gif" medium="image">
			<media:title type="html">Result of the previous SQL query</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX : Error: 18486 Login failed for user &#8216;sa&#8217; because the account is currently locked out. The system administrator can unlock it. &#8211; Unlock SA Login</title>
		<link>http://blog.sqlauthority.com/2009/04/23/sql-server-fix-error-18486-login-failed-for-user-sa-because-the-account-is-currently-locked-out-the-system-administrator-can-unlock-it-unlock-sa-login/</link>
		<comments>http://blog.sqlauthority.com/2009/04/23/sql-server-fix-error-18486-login-failed-for-user-sa-because-the-account-is-currently-locked-out-the-system-administrator-can-unlock-it-unlock-sa-login/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 01:30:22 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></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 Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4488</guid>
		<description><![CDATA[Today, we will riffle through a very simple, yet common issue &#8211; How to unlock a locked &#8220;sa&#8221; login? It is quite a common practice that SQL Server is hosted on a separate server than application server. In most cases, SQL Server ports or IP are exposed to the web, which makes them risk prone. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4488&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Today, we will riffle through a very simple, yet common issue &#8211; <em><strong>How to unlock a locked &#8220;sa&#8221; login?</strong></em></p>
<p style="text-align:justify;">It is quite a common practice that SQL Server is hosted on a separate server than application server. In most cases, SQL Server ports or IP are exposed to the web, which makes them risk prone. For hackers, System Admin login &#8220;sa&#8221; is the preferred account which they use for hacking. In fact, a majority of hackers try to hack into SQL Server by attempting to login using &#8220;sa&#8221; account. Once hackers gain access to server using &#8220;sa&#8221; login, they get a complete control over the SQL Server.</p>
<p style="text-align:justify;">Hackers apply Brute Force method to hack &#8220;sa&#8221; login. Brute Force method is an attempt to guess a password using every possible combination. Be it in your machine where SQL Server is hosted or in your domain, if you have a policy setting that disables any account after a certain number of unsuccessful attempts, it will also disable all your SQL Server logins including &#8220;sa&#8221; login. In this scenario, SQL Server will display the following error:</p>
<p style="text-align:justify;"><span style="color:#ff0000;">msg: 18486<br />
Login failed for user &#8216;sa&#8217; because the account is currently locked out. The system administrator can unlock it.<br />
</span>
</p>
<p style="text-align:justify;"><strong>Fix/Solution/Workaround:</strong></p>
<p style="text-align:justify;">1) Disable the policy on your system or on your domain level. However, this may not be the most appropriate option as it will adversely affect your security protection level.</p>
<p style="text-align:justify;">2) If this is a one-time issue, enable &#8220;sa&#8221; login WITH changing password of &#8220;sa&#8221; login.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">ALTER </span><span style="color:black;">LOGIN sa </span><span style="color:blue;">WITH </span><span style="color:black;">PASSWORD </span><span style="color:blue;">= </span><span style="color:red;">'yourpass' </span><span style="color:black;">UNLOCK </span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code>
</p>
<p style="text-align:justify;">3) If this is a one-time issue, enable &#8220;sa&#8221; login WITHOUT changing password of &#8220;sa&#8221; login.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">ALTER </span><span style="color:black;">LOGIN sa </span><span style="color:blue;">WITH </span><span style="color:black;">CHECK_POLICY </span><span style="color:blue;">= OFF</span><span style="color:gray;">;<br />
</span><span style="color:blue;">ALTER </span><span style="color:black;">LOGIN sa </span><span style="color:blue;">WITH </span><span style="color:black;">CHECK_POLICY </span><span style="color:blue;">= ON</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code>
</p>
<p style="text-align:justify;">4) If you are not using &#8220;sa&#8221; login, switch your authentication from mixed mode authentication to windows authentication to remove your &#8220;sa&#8221; login account.</p>
<p style="text-align:justify;">5) <strong>BEST Practice: </strong>Create another user with systemadmin role having the same rights as &#8220;sa&#8221; login and let &#8220;sa&#8221; login get disabled. Use the newly created account as this will not be exposed on the Internet and for hackers it will be a tough nut to crack! They will find it difficult to guess the right password and moreover, they will not be able to do Brute Force attack over it.</p>
<p style="text-align:justify;">I am eager to know if there are other options to solve this problem.</p>
<p style="text-align:justify;">If you simply want to change the &#8220;sa&#8221; password, you can follow my previous article <strong><a href="http://blog.sqlauthority.com/2007/12/29/sql-server-change-password-of-sa-login-using-management-studio/" target="_blank">SQL SERVER &#8211; Change Password of SA Login Using Management Studio</a></strong>.</p>
<p style="text-align:justify;">Please note that it is not mandatory to reboot SQL Server or restart SQL Server services after changing the password for &#8220;sa&#8221; login. If you are interested, go through all the <a href="http://blog.sqlauthority.com/2007/12/29/sql-server-change-password-of-sa-login-using-management-studio/" target="_blank">comments </a>and bring forth your opinion about this discussion.</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>
<p style="text-align:justify;">
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology Tagged: hacking <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4488/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4488/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4488/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4488&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/23/sql-server-fix-error-18486-login-failed-for-user-sa-because-the-account-is-currently-locked-out-the-system-administrator-can-unlock-it-unlock-sa-login/feed/</wfw:commentRss>
		<slash:comments>17</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; Check if Current Login is Part of Server Role Member</title>
		<link>http://blog.sqlauthority.com/2009/04/14/sql-server-check-if-current-login-is-part-of-server-role-member/</link>
		<comments>http://blog.sqlauthority.com/2009/04/14/sql-server-check-if-current-login-is-part-of-server-role-member/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 01:30:23 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></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[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4333</guid>
		<description><![CDATA[I often work on consulting projects with umpteen clients from across the globe. The nature of the works I usually receive necessitates me to take on the role of a system admin. Now, this role is trailed by come common issues. This article revolves around one such concern. Most of the time, I get login [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4333&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I often work on consulting projects with umpteen clients from across the globe. The nature of the works I usually receive necessitates me to take on the role of a system admin. Now, this role is trailed by come common issues. This article revolves around one such concern.</p>
<p style="text-align:justify;">Most of the time, I get login and DBA from my clients. However, sometimes I face login-related problems, primarily because my clients forget to confer admin rights on me. Anticipating this situation I perform a simple task, which saves my time and saves me from exasperation.  Whenever I receive a server login I run the following query to verify if  the client has assigned me the role of system admin or not.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">IS_SRVROLEMEMBER</span><span style="color:gray;">(</span><span style="color:red;">'sysadmin'</span><span style="color:gray;">);</span></code></p>
<p style="text-align:justify;">If I have been assigned system admin role then the result will be 1 else it will be 0.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/isrole.jpg" alt="" width="416" height="167" /></p>
<p style="text-align:justify;">
<p style="text-align:justify;">I have listed below valid roles that can be verified using the above function.</p>
<p style="padding-left:60px;text-align:justify;">sysadmin<br />
dbcreator<br />
diskadmin<br />
processadmin<br />
serveradmin<br />
setupadmin<br />
securityadmin
</p>
<p style="text-align:justify;">If you pass an invalid role to the above function, it will return value NULL.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/isrole1.jpg" alt="" width="458" height="140" /></p>
<p style="text-align:justify;">
<p style="text-align:justify;">I hope my article is clear to all my readers. Please send me your feedback. I want my readers to come up with more issues that need to be tackled.</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, SQL, SQL Add-On, SQL Authority, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, SQLServer, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4333/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4333/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4333/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4333&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/14/sql-server-check-if-current-login-is-part-of-server-role-member/feed/</wfw:commentRss>
		<slash:comments>4</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/isrole.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/isrole1.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Fix : Error : Msg 9803, Level 16. Invalid data for type &#8220;numeric&#8221; &#8211; Data Type Mapping for Oracle Publishers</title>
		<link>http://blog.sqlauthority.com/2009/04/09/sql-server-fix-error-msg-9803-level-16-invalid-data-for-type-numeric-data-type-mapping-for-oracle-publishers/</link>
		<comments>http://blog.sqlauthority.com/2009/04/09/sql-server-fix-error-msg-9803-level-16-invalid-data-for-type-numeric-data-type-mapping-for-oracle-publishers/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 01:30:39 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4267</guid>
		<description><![CDATA[My present article talks about an error that you will encounter when connecting to Oracle database using OPENQUERY. The error that eventuates is as follows: Msg 9803, Level 16, State 1, Line 1 Invalid data for type &#8220;numeric&#8221;. Fix/Solution/Workaround: As far as I can discern, the above error occurs due to numeric precision or numeric [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4267&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">My present article talks about an error that you will encounter when connecting to Oracle database using OPENQUERY.</p>
<p style="text-align:justify;">The error that eventuates is as follows:</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Msg 9803, Level 16, State 1, Line 1<br />
Invalid data for type &#8220;numeric&#8221;.</span>
</p>
<p style="text-align:justify;"><strong>Fix/Solution/Workaround:</strong></p>
<p style="text-align:justify;">As far as I can discern, the above error occurs due to numeric precision or numeric definition mismatch. The number field of SQL Server does not appropriately match with the number field of Oracle. In fact, apart from number field there are several other data types that do not match.</p>
<p style="text-align:justify;">I am including the following sample query having NumberCol that is Integer field of SQL Server and it needs to be converted To_Char to match up. NumberCol can be matched to Numeric in Oracle as well.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">CONVERT</span><span style="color:gray;">(</span><span style="color:blue;">INT</span><span style="color:gray;">, </span><span style="color:black;">NumberCol</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">NumberCol<br />
</span><span style="color:blue;">FROM OPENQUERY </span><span style="color:gray;">(</span><span style="color:black;">YourConnectionMethod</span><span style="color:gray;">, </span><span style="color:red;">'SELECT TO_CHAR(NumberCol) AS NumberCol FROM RemoteTbl'</span><span style="color:gray;">); </span></code>
</p>
<p style="text-align:justify;">Do read the article of MSDN to have a sound knowledge about <strong><a href="http://msdn.microsoft.com/en-us/library/ms151817.aspx" target="_blank">Data Type Mapping for Oracle Publishers</a></strong>.</p>
<p style="text-align:justify;">Please drop a line to me and let me have your doubts and questions. Your suggestions are always welcome!</p>
<p style="text-align:justify;"><strong><a href="http://msdn.microsoft.com/en-us/library/ms151817.aspx" target="_blank"></a></strong></p>
<p style="text-align:justify;"><strong></strong></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, SQL, SQL Authority, SQL Error Messages, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: Oracle <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=4267&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/04/09/sql-server-fix-error-msg-9803-level-16-invalid-data-for-type-numeric-data-type-mapping-for-oracle-publishers/feed/</wfw:commentRss>
		<slash:comments>5</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; Activity Monitor is Empty &#8211; Fix Activity Monitor for All Users</title>
		<link>http://blog.sqlauthority.com/2009/03/22/sql-server-2008-activity-monitor-is-empty-fix-activity-monitor-for-all-users/</link>
		<comments>http://blog.sqlauthority.com/2009/03/22/sql-server-2008-activity-monitor-is-empty-fix-activity-monitor-for-all-users/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 01:30:17 +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 Error Messages]]></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[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Activity Monitor]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=3862</guid>
		<description><![CDATA[This article is outcome of the technical discussion of activity monitor and its behavior with my friend and SQL Expert Tejas Shah. Tejas told me that he does not like to re-write content from MSDN but rather prefer to write real life scenarios, as that prepares him to become better SQL Expert. While discussing about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=3862&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">This article is outcome of the technical discussion of activity monitor and its behavior with my friend and SQL Expert <strong><a href="http://tejasnshah.wordpress.com/" target="_blank">Tejas Shah</a></strong>. Tejas told me that he does not like to re-write content from MSDN but rather prefer to write real life scenarios, as that prepares him to become better SQL Expert. While discussing about Activity Monitor he informed that activity monitor throws an error when there is permissions issue. He has even blogged about <a href="http://tejasnshah.wordpress.com/2009/03/22/sql-server-unable-to-launch-activity-monitor-how-to-give-view-server-state-permissions-to-launch-activity-monitor/" target="_blank">how to give permissions to user to launch activity monitor</a> on his blog . Tejas asked me to write on the same subject for SQL Server 2008. Here is the article covering the discussion I had with Tejas.</p>
<p style="text-align:justify;">I have user called &#8216;ActivityUser&#8217; when turned on Activity Monitor (while logging in with user ActivityUser&#8217;) it does not have show anything in Activity Monitor.</p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/bimg/avmon/av1.jpg"><img class="alignnone" src="http://www.pinaldave.com/bimg/avmon/av1_s.jpg" alt="" width="500" height="263" /></a></p>
<p style="text-align:justify;">The issue here is permissions issue. If user ActivityUser is given all the necessary permission it will start showing up data in Activity Monitor. Activity Monitor is new tool in SQL Server which displays activity in five sections. 1) Overview, 2) Processes, 3) Resources Waits, 4) Data File I/O, 5) Recent Expensive Queries. It is one of the new and very useful tool introduced by SQL Server.</p>
<p style="text-align:justify;">Activity Monitor captures all the information at server level. For the same reason we need to give <em><strong>&#8220;View Server State&#8221;</strong></em> permission to user name to view data of Activity Monitor.We can give permission either using T-SQL or using SSMS.</p>
<p style="text-align:justify;">T-SQL to give permission to user to view Activity Monitor:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/avmon/av2.jpg" alt="" width="429" height="232" /></p>
<p style="text-align:justify;">SSMS to give permission to user to view Activity Monitor:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/avmon/av3.jpg" alt="" width="500" height="449" /></p>
<p style="text-align:justify;">Once permissions is given to user, it displays the data in Activity Monitor. Click on images to enlarge the images.</p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/bimg/avmon/av4.jpg"><img class="alignnone" src="http://www.pinaldave.com/bimg/avmon/av4_s.jpg" alt="" width="500" height="281" /></a></p>
<p style="text-align:justify;">Additionally, note that if you are user belonging to sysadmin role, you can always see all the data in Activity Monitor without additional permissions.</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 Error Messages, SQL Performance, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Activity Monitor <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/3862/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/3862/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/3862/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=3862&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/03/22/sql-server-2008-activity-monitor-is-empty-fix-activity-monitor-for-all-users/feed/</wfw:commentRss>
		<slash:comments>5</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/avmon/av1_s.jpg" medium="image" />

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

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

		<media:content url="http://www.pinaldave.com/bimg/avmon/av4_s.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Disable Windows Authentication &#8211; Remove Windows Authentication Login Account</title>
		<link>http://blog.sqlauthority.com/2009/02/24/sql-server-disable-windows-authentication-remove-windows-authentication-login-account/</link>
		<comments>http://blog.sqlauthority.com/2009/02/24/sql-server-disable-windows-authentication-remove-windows-authentication-login-account/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 01:30:18 +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 Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Login]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2795</guid>
		<description><![CDATA[I just received following email from one of the blog reader. Question : &#8220;How to disable Windows Authentication?&#8221; Answer : It can not be disabled. Windows Authentication is the most secure way to login in system. Reference : Pinal Dave (http://blog.SQLAuthority.com) Posted in Pinal Dave, SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2795&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I just received following email from one of the blog reader.</p>
<p style="text-align:justify;"><strong>Question : </strong>&#8220;How to disable Windows Authentication?&#8221;</p>
<p style="text-align:justify;"><strong>Answer :</strong> It can not be disabled. Windows Authentication is the most secure way to login in system.</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, SQL, SQL Authority, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: SQL Login <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/2795/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/2795/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/2795/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2795&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/02/24/sql-server-disable-windows-authentication-remove-windows-authentication-login-account/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; Find Current Location of Data and Log File of All the Database</title>
		<link>http://blog.sqlauthority.com/2009/02/17/sql-server-find-current-location-of-data-and-log-file-of-all-the-database/</link>
		<comments>http://blog.sqlauthority.com/2009/02/17/sql-server-find-current-location-of-data-and-log-file-of-all-the-database/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 01:30:45 +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 Documentation]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL System Table]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2593</guid>
		<description><![CDATA[As I am doing lots of experiments on my SQL Server test box, I sometime gets too many files in SQL Server data installation folder &#8211; the place where I have all the .mdf and .ldf files are stored. I often go to that folder and clean up all unnecessary files I have left there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2593&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">As I am doing lots of experiments on my SQL Server test box, I sometime gets too many files in SQL Server data installation folder &#8211; the place where I have all the .mdf and .ldf files are stored. I often go to that folder and clean up all unnecessary files I have left there taking up my hard drive space. I run following query to find out which .mdf and .ldf files are used and delete all other files. If your SQL Server is up and running OS will not let you delete .mdf and .ldf files any way giving you error that file already in use. This list also helps sometime to do documentation of which files are in being used by which database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">name</span><span style="color:gray;">, </span><span style="color:black;">physical_name </span><span style="color:blue;">AS </span><span style="color:black;">current_file_location<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.master_files</span></code>
</p>
<p style="text-align:justify;">Following is the output of files used by my SQL Server instance.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/mastefiles.jpg" alt="" width="500" height="394" /></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>
<p style="text-align:justify;">
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Backup and Restore, SQL Documentation, SQL Query, SQL Scripts, SQL Security, SQL Server, SQL System Table, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/2593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/2593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/2593/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2593&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/02/17/sql-server-find-current-location-of-data-and-log-file-of-all-the-database/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/mastefiles.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Reasons to Backup Master Database &#8211; Why Should Master Database Backedup</title>
		<link>http://blog.sqlauthority.com/2009/02/15/sql-server-reasons-to-backup-master-database-why-should-master-database-backedup/</link>
		<comments>http://blog.sqlauthority.com/2009/02/15/sql-server-reasons-to-backup-master-database-why-should-master-database-backedup/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 01:30:06 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></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 Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2582</guid>
		<description><![CDATA[The most interesting thing about writing blog at SQLAuthority.com is follow up question. Just a day before I wrote article about SQL SERVER &#8211; Restore Master Database &#8211; An Easy Solution, right following it, I received email from user requesting reason for importance of backing up master database. Master database contains all the system level [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2582&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">The most interesting thing about writing blog at SQLAuthority.com is follow up question. Just a day before I wrote article about <strong><a href="http://blog.sqlauthority.com/2009/02/14/sql-server-restore-master-database-an-easy-solution/" target="_blank">SQL SERVER &#8211; Restore Master Database &#8211; An Easy Solution</a></strong>, right following it, I received email from user requesting reason for importance of backing up master database.</p>
<p style="text-align:justify;">Master database contains all the system level information of server. Information about all the login account, system configurations and information required to access all the other database are stored in master database. If master database is damaged, it will be difficult to use any other database in SQL Server and that makes it most important database of the SQL Server.</p>
<p style="text-align:justify;">Let us understand the important of the master database using an example. We will take example of SQL Server DBA and follow his timeline. Make sure to understand it correctly, as I have small question at the end of the timeline.</p>
<p style="text-align:justify;">9:00 AM &#8211; DBA takes backup of the master database.<br />
10:00 AM &#8211; DBA creates new Database named <em><strong>AfterMaster</strong></em>.<br />
11:00 AM &#8211; DBA restores the master database backup taken at 9:00 AM.<br />
12:00 PM &#8211; I have following two questions for the DBA :</p>
<p style="text-align:justify;"><em><strong>Question 1)</strong> What will be the state of the database AfterMaster? If AfterMaster database will be in active state after restoring master database?<br />
<strong>Question 2) </strong>What should be the next step after restoring master database?</em>
</p>
<p style="text-align:justify;">Let us understand the answer of question.</p>
<p style="text-align:justify;"><em><strong>Answer 1)</strong></em> Once master database is restored it will have no record of AfterMaster database in its system database and it will not recognize it.<br />
<em><strong>Answer 2)</strong></em> If master database is restored from backup all the operation which are done after last master database backup should be repeated in order to bring SQL Server in the current operational state. In our case, the database files (ldf and mdf) of AfterMaster database will still exists on server. They should be reattached to the server. You can search about how to attach mdf and ldf file at <strong><a href="http://search.sqlauthority.com" target="_blank">Search@SQLAuthority.com</a></strong>.
</p>
<p style="text-align:justify;">It is clear from our example that master database contains user login, files, filegroups and server wide settings.</p>
<p style="text-align:justify;">In summary, it is extremely important to take backup of the master database.</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 />Posted in Best Practices, Pinal Dave, SQL, SQL Authority, SQL Backup and Restore, SQL Data Storage, SQL Query, SQL Security, SQL Server, SQL Tips and Tricks, SQL Utility, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/2582/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/2582/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/2582/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=2582&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/02/15/sql-server-reasons-to-backup-master-database-why-should-master-database-backedup/feed/</wfw:commentRss>
		<slash:comments>2</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>
