<?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>Journey to SQL Authority with Pinal Dave &#187; SQL Coding Standards</title>
	<atom:link href="http://blog.sqlauthority.com/category/sql-coding-standards/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Notes of a SQL Server MVP and Database Administrator</description>
	<lastBuildDate>Sat, 21 Nov 2009 01:30:19 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='blog.sqlauthority.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/08e35387c05b61340e885b1763a69d9f?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Journey to SQL Authority with Pinal Dave &#187; SQL Coding Standards</title>
		<link>http://blog.sqlauthority.com</link>
	</image>
			<item>
		<title>SQL SERVER &#8211; Questions and Answers with Database Administrators</title>
		<link>http://blog.sqlauthority.com/2009/05/11/sql-server-questions-and-answers-with-database-administrators/</link>
		<comments>http://blog.sqlauthority.com/2009/05/11/sql-server-questions-and-answers-with-database-administrators/#comments</comments>
		<pubDate>Mon, 11 May 2009 01:30:58 +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 Coding Standards]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=4474</guid>
		<description><![CDATA[I have been in India for long time now, and at present, I am managing a very large outsourcing project. Recently, we conducted few interviews since the project required more Database Administrators and Senior Developers, and I must say it was an enthralling experience for me! I got the opportunity to meet some very talented [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4474&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I have been in India for long time now, and at present, I am managing a very large outsourcing project. Recently, we conducted few interviews since the project required more Database Administrators and Senior Developers, and I must say it was an enthralling experience for me! I got the opportunity to meet some very talented and competent programmers from all over the country. Scores of interesting questions were discussed between the interviewers and the candidates, which made the whole interview process nothing short of an enriching occasion! I am listing some of the interesting questions discussed during the interviews. Some are technical and some are purely my personal opinion.</p>
<p style="text-align:justify;"><strong>Q. According to you what goes into making the best Database Administrator?</strong></p>
<p style="text-align:justify;">A. The primary job of DBAs is to secure the data. They should be able to keep it safe as well as reproduce it efficiently, whenever required. So as per my view, a Database Administrator who can fulfill the requirements of Securing Data and Retrieving Data is the best DBA.</p>
<p style="text-align:justify;">When I hire a DBA I always ask them questions about backup strategies and efficient restoring methodologies.<br />
<strong><br />
Q. I have all the primary data files, secondary data files as well as logs. Now, tell me can I still restore the database without having a full backup?</strong>
</p>
<p style="text-align:justify;">A. You cannot restore the database without having a full database backup. However, if you have the copy of all the data files (.mdf and .ndf) and logs (.ldf) when database was in working condition (or your desired state) it is possible to  attach that database using sp_attach_db.</p>
<p style="text-align:justify;"><strong>Q. As per your opinion what are the five top responsibilities of a DBA?</strong></p>
<p style="text-align:justify;">A.  I rate the following five tasks as the key responsibilities of a DBA.</p>
<p style="text-align:justify;">1. Securing database from physical and logical integrity damage.<br />
2. Restoring database from backup as a part of disaster management plan.<br />
3. Optimizing queries performance by appropriate indexing and optimizing joins, where conditions, select clause etc.<br />
4. Designing new schema, support legacy schema, and legacy database systems.<br />
5. Helping developers improve their SQL-related code writing skill.
</p>
<p style="text-align:justify;"><strong>Q. One of the developers in my company moved one of the columns from one table to some other table in the same database. How can I find the name of the new table where the column has been moved?</strong></p>
<p style="text-align:justify;">A. This question can be answered by querying system views.</p>
<p style="text-align:justify;">For SQL Server 2005 run the following code:<br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">OBJECT_NAME</span><span style="color:gray;">(</span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">) </span><span style="color:black;">TableName<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.columns<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">name </span><span style="color:blue;">= </span><span style="color:red;">'YourColumnName' </span></code></p>
<p style="text-align:justify;">The previous query will return all the tables that use the column name specified in the WHERE condition. This is a very small but a very handy script.<br />
<strong><br />
Q. What is the difference between SQL Server 2000 object owner and SQL Server 2005 schema?</strong>
</p>
<p style="text-align:justify;">A. Let us first see the fully qualified query name to access a table for SQL Server 2000 and SQL Server 2005.</p>
<p style="text-align:justify;"><strong>SQL Server 2000:</strong> [DataBaseServer].[DataBaseName].[ObjectOwner].[Table]</p>
<p style="text-align:justify;"><strong>SQL Server 2005:</strong> [DataBaseServer].[DataBaseName].[Schema].[Table]</p>
<p style="text-align:justify;"><strong>SQL Server 2008:</strong> [DataBaseServer].[DataBaseName].[Schema].[Table]</p>
<p style="text-align:justify;">In SQL Server 2000, prior to dropping the user who owns database objects, all the objects belonging to that user either need to be dropped or their owner has to be changed. Every time a user is dropped or modified, system admin has to undergo this inconvenient process.<br />
In SQL Server 2005 and the later versions, instead of accessing a database through database owner, it can be accessed through a schema. Users are assigned to schemas, and by using this schema a user can access database objects. Multiple users can be assigned to a single schema, and they all can automatically receive the same permissions and credentials as the schema to which they are assigned. Because of the same reason in SQL Server 2005 and the later versions &#8211; when a user is dropped from database &#8211; there is no negative effect on the database itself.
</p>
<p style="text-align:justify;"><strong>Q. What is BI? I have heard this term before but I have no idea about it?</strong></p>
<p style="text-align:justify;">A. BI stands for Business Intelligence. Microsoft started to promote the acronym BI since the launch of SQL Server 2005. However, it has been in use for a long time. The basic idea of BI is quite similar to Data Warehousing. Business intelligence is a method for storing and presenting accurate and timely key enterprise data to CXO, IT Managers, Business Consultants, and distributed teams of a company, to provide them with up-to-date information to drive intelligent decisions for business success, which ultimately leads to enhanced revenue, reduced risk, decreased cost, and better operational control for business agility and competitiveness. An effective BI empowers end users to use data to understand the cause that led to a particular business result, to decide on the course of action based on past data, and to accurately forecast future results.</p>
<p style="text-align:justify;"><strong>Q. What is your recommendation for a query running very slow?</strong></p>
<p style="text-align:justify;">A. Well, your question is very difficult to answer without looking at the code, application and physical server. In such situations, there are a few things that must be paid attention to right away.</p>
<ul style="text-align:justify;">
<li>Restart Server</li>
<li>Upgrade Hardware</li>
<li>Check Indexes on Tables and Create Indexes if necessary</li>
<li>Make sure SQL Server has priority over other operating system processes in SQL Server settings</li>
<li>Update statistics on the database tables.</li>
</ul>
<p style="text-align:justify;"><strong>Q. What should be the fill factor for Indexes created on tables?</strong></p>
<p style="text-align:justify;">A. Fill factor specifies a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or alteration. Fill factor must be an integer value from 1 to 100. The default is 0. I prefer to keep my servers default fill factor as 90.</p>
<p style="text-align:justify;"><strong>Q. Which feature in SQL Server 2008 has surprised you? You can name just one.</strong></p>
<p style="text-align:justify;">A. Plan Freezing is a new feature I never thought of. I find it very interesting!  It is included in SQL Server 2008 CTP5. SQL Server 2008 enables greater query performance stability and predictability by providing new functionality to lock down query plans. This empowers organizations to promote stable query plans across hardware server replacements, server upgrades, and production deployments.</p>
<p style="text-align:justify;"><strong>Q. How do you test your database?</strong></p>
<p style="text-align:justify;">This is a very generic question. I would like to describe my generic database testing method as well as stored procedure testing methods.</p>
<p style="text-align:justify;">Testing Databases:</p>
<ul style="text-align:justify;">
<li>Table Column data type and data value validation.</li>
<li>Index implementation and performance improvement.</li>
<li>Constraints and Rules should be validated for data integrity.</li>
<li>Application field length and type should match the corresponding database field.</li>
<li>Database objects like stored procedures, triggers, functions should be tested using different kinds of input values and checking the expected output variables.</li>
</ul>
<p style="text-align:justify;">Testing Stored Procedures:</p>
<ul style="text-align:justify;">
<li>Understand the requirements in terms of Business Logic.</li>
<li>Check if the  code follows all the coding standards.</li>
<li>Compare the fields&#8217; requirements of application to the fields retrieved by a stored procedure. They must match.</li>
<li>Repeatedly run the stored procedures several times with different input parameters and then compare the output with the expected results.</li>
<li>Pass invalid input parameters and see if a stored procedure has good error handling.</li>
</ul>
<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/QuestionAnswersWithDataBaseAdministrators.aspx" target="_blank">DotNetSlackers</a><strong><br />
</strong></p>
Posted in Best Practices, Pinal Dave, SQL, SQL Authority, SQL Coding Standards, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/4474/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/4474/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/4474/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/4474/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/4474/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/4474/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/4474/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/4474/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/4474/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/4474/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=4474&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2009/05/11/sql-server-questions-and-answers-with-database-administrators/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; 2008 &#8211; Cheat Sheet &#8211; One Page PDF Download</title>
		<link>http://blog.sqlauthority.com/2008/10/02/sql-server-2008-cheat-sheet-one-page-pdf-download/</link>
		<comments>http://blog.sqlauthority.com/2008/10/02/sql-server-2008-cheat-sheet-one-page-pdf-download/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 01:30:48 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Cheat Sheet]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1289</guid>
		<description><![CDATA[Very frequently I have been asked to create a page, post or article where in one page all the important concepts of SQL Server are covered. SQL Server 2008 is very large subject and can not be even covered 1000 of pages. In daily life of DBA there are few commands very frequently used and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1289&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Very frequently I have been asked to create a page, post or article where in one page all the important concepts of SQL Server are covered. SQL Server 2008 is very large subject and can not be even covered 1000 of pages. In daily life of DBA there are few commands very frequently used and for novice developers it is good to keep all the important SQL Script and SQL Statements handy.</p>
<p style="text-align:justify;">I have attempted to create cheat sheet for SQL Server 2008 most important commands. User can print this in one A4 size page and keep along with them. This can be used in interviews where T-SQL scripts are being asked.</p>
<p style="text-align:justify;">Let me know your opinion and if you find this useful.</p>
<h2 style="text-align:justify;"><a href="http://www.pinaldave.com/best-sql-server-download.cfm?download=SQL-SERVER-Cheat-Sheet" target="_blank">Download SQL Server 2008 Cheat Sheet</a></h2>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
Posted in Best Practices, Database, DBA, Pinal Dave, Software Development, SQL, SQL Add-On, SQL Authority, SQL Coding Standards, SQL Documentation, SQL Download, SQL Interview Questions and Answers, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, SQL Utility, T SQL, Technology Tagged: SQL Cheat Sheet <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/1289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/1289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/1289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/1289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/1289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/1289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/1289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/1289/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/1289/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/1289/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1289&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/10/02/sql-server-2008-cheat-sheet-one-page-pdf-download/feed/</wfw:commentRss>
		<slash:comments>22</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; Guidelines and Coding Standards Complete List Download</title>
		<link>http://blog.sqlauthority.com/2008/09/25/sql-server-guidelines-and-coding-standards/</link>
		<comments>http://blog.sqlauthority.com/2008/09/25/sql-server-guidelines-and-coding-standards/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 01:30:54 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQLAuthority]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

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

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1110</guid>
		<description><![CDATA[
 To express apostrophe within a string, nest single quotes (two single quotes).
Example:
SET @sExample = 'SQL''s Authority'

 When working with branch conditions or complicated expressions, use parenthesis to increase readability.
IF ((SELECT 1
FROM TableName
WHERE 1=2) ISNULL)

 To mark single line as comment use (&#8211;) before statement. To mark section of code as comment use (/*&#8230;*/).


 Avoid the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1110&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><ul class="unIndentedList" style="text-align:justify;">
<li> To express <strong>apostrophe</strong> within a string, nest single quotes (two single quotes).</li>
<p>Example:</p>
<p><code style="font-size:12px;"><span style="color:blue;">SET </span><span style="color:#434343;">@sExample </span><span style="color:blue;">= </span><span style="color:red;">'SQL''s Authority'</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> When working with branch conditions or <strong>complicated expressions</strong>, use parenthesis to increase readability.</li>
<p><code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">((</span><span style="color:blue;">SELECT </span><span style="color:black;">1<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TableName<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">1</span><span style="color:blue;">=</span><span style="color:black;">2</span><span style="color:gray;">) </span><span style="color:magenta;">ISNULL</span><span style="color:gray;">)</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> To mark single line as comment use (&#8211;) before statement. To mark section of code as comment use (/*&#8230;*/).</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Avoid the use of cross joins if possible. (<a href="http://blog.sqlauthority.com/2007/04/20/sql-server-interview-questions-part-6/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> If there is no need of resultset then use syntax that doesn&#8217;t return a resultset.</li>
<p><code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">EXISTS   (</span><span style="color:blue;">SELECT </span><span style="color:black;">1</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM </span><span style="color:black;">UserDetails</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">WHERE </span><span style="color:black;">UserID </span><span style="color:blue;">= </span><span style="color:black;">50</span><span style="color:gray;">)</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">Rather than,<br />
<code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">EXISTS  (</span><span style="color:blue;">SELECT </span><span style="color:magenta;">COUNT </span><span style="color:gray;">(</span><span style="color:black;">UserID</span><span style="color:gray;">)</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM </span><span style="color:black;">UserDetails</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">WHERE </span><span style="color:black;">UserID </span><span style="color:blue;">= </span><span style="color:black;">50</span><span style="color:gray;">)</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use graphical execution plan in <strong>Query Analyzer</strong> or <strong>SHOWPLAN_TEXT</strong> or <strong>SHOWPLAN_ALL</strong> commands to analyze SQL queries. Your queries should do an <strong>&#8220;Index Seek&#8221;</strong> instead of an &#8220;Index Scan&#8221; or a &#8220;Table Scan&#8221;. (<a href="http://blog.sqlauthority.com/2007/08/28/sql-server-actual-execution-plan-vs-estimated-execution-plan/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not prefix stored procedure names with &#8220;SP_&#8221;, as<strong> &#8220;SP_&#8221; is reserved for system stored procedures</strong>.<br />
Example:<br />
<strong>SP&lt;App Name&gt;_ [&lt;Group Name &gt;_] &lt;Action&gt;&lt;table/logical instance&gt;</strong></li>
<li> Incorporate your frequently required, complicated joins and calculations into a <strong>view</strong> so that you don&#8217;t have to repeat those joins/calculations in all your queries. Instead, just select from the view. (<a href="http://blog.sqlauthority.com/2007/08/12/sql-server-fix-error-msg-1033-level-15-state-1-the-order-by-clause-is-invalid-in-views-inline-functions-derived-tables-subqueries-and-common-table-expressions-unless-top-or-for-xml-is-als/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not query / manipulate the data directly in your front end application, instead <strong>create stored procedures</strong>, and let your applications to access stored procedure.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Avoid using <strong>ntext</strong>, <strong>text</strong>, and <strong>image</strong> data types in new development work. Use <a href="http://msdn.microsoft.com/en-us/library/ms186939.aspx">nvarchar (max)</a>, <a href="http://msdn.microsoft.com/en-us/library/ms176089.aspx">varchar (max)</a>, and <a href="http://msdn.microsoft.com/en-us/library/ms188362.aspx">varbinary (max)</a> instead.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not store <strong>binary or image files (Binary Large Objects or BLOBs)</strong> inside the database. Instead, store the path to the binary or image file in the database and use that as a pointer to the actual file stored on a server.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use the <strong>CHAR</strong> datatype for a non-nullable column, as it will be the fixed length column, NULL value will also block the defined bytes.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Avoid using dynamic SQL statements</strong>. Dynamic SQL tends to be slower than static SQL, as SQL Server generate execution plan every time at runtime.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Minimize the use of Nulls. Because they incur more complexity in queries and updates. <strong>ISNULL</strong> and <strong>COALESCE</strong> functions are helpful in dealing with NULL values</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>Unicode</strong> datatypes, like <strong>NCHAR, NVARCHAR</strong> or <strong>NTEXT</strong> if it needed, as they use twice as much space as non-Unicode datatypes.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Always use column list in <strong>INSERT</strong> statements of SQL queries. This will avoid problem when table structure changes.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Perform all <strong>referential integrity</strong> checks and <strong>data validations</strong> using <strong>constraints</strong> instead of <strong>triggers</strong>, as they are faster. Limit the use of triggers only for auditing, custom tasks, and validations that cannot be performed using constraints.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Always access tables in the same order in all stored procedure and triggers consistently. This will avoid deadlocks. (<a href="http://blog.sqlauthority.com/2007/05/16/sql-server-fix-error-1205-transaction-process-id-was-deadlocked-on-resources-with-another-process-and-has-been-chosen-as-the-deadlock-victim-rerun-the-transaction/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not call functions repeatedly in stored procedures, triggers, functions and batches, instead call the function once and store the result in a variable, for later use.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> With Begin and End Transaction always use global variable <strong>@@ERROR</strong>, immediately after data manipulation statements (INSERT/UPDATE/DELETE), so that if there is an Error the transaction can be <strong>rollback</strong>.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Excessive usage of <strong>GOTO</strong> can lead to hard-to-read and understand code.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not use <strong>column numbers</strong> in the ORDER BY clause; it will reduce the readability of SQL query.<br />
Example: <em>Wrong Statement</em><br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">UserID</span><span style="color:gray;">, </span><span style="color:black;">UserName</span><span style="color:gray;">, </span><span style="color:black;">Password<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">UserDetails<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">2</span></code></li>
<p>Example: <em>Correct Statement</em><br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">UserID</span><span style="color:gray;">, </span><span style="color:black;">UserName</span><span style="color:gray;">, </span><span style="color:black;">Password<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">UserDetails<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">UserName</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> To avoid <strong>trips from application to SQL Server</strong>, we should retrive multiple resultset from single Stored Procedure instead of using output param.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> The <strong>RETURN</strong> statement is meant for returning the execution status only, but not data. If you need to return data, use <strong>OUTPUT</strong> parameters.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> If stored procedure always returns single row resultset, then consider returning the resultset using <strong>OUTPUT</strong> parameters instead of <strong>SELECT</strong> statement, as ADO handles OUTPUT parameters faster than resultsets returned by SELECT statements.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Effective <strong>indexes</strong> are one of the best ways to improve performance in a database application.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>BULK INSERT</strong> command helps to import a data file into a database table or view in a user‐specified format.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>Policy Management</strong> to make or define and enforce your own policies fro configuring and managing SQL Server across the enterprise, eg. Policy that Prefixes for stored procedures should be sp.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>sparse columns</strong> to reduce the space requirements for null values. (<span style="text-decoration:underline;">Read More Here</span>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>MERGE Statement</strong> to implement multiple DML operations instead of writing separate INSERT, UPDATE, DELETE statements.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> When some particular records are retrieved frequently, apply <strong>Filtered Index</strong> to improve query performace, faster retrieval and reduce index maintenance costs.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Using the <strong>NOLOCK</strong> query optimizer hint is considered good practice in order to improve concurrency on a busy system.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>EXCEPT </strong>or <strong>NOT EXIST</strong> clause can be used in place of LEFT JOIN or NOT IN for better peformance.</li>
<p>Example:<br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">EmpNo</span><span style="color:gray;">, </span><span style="color:black;">EmpName</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM </span><span style="color:black;">EmployeeRecord</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">WHERE </span><span style="color:black;">Salary </span><span style="color:gray;">&gt; </span><span style="color:black;">1000 </span><span style="color:gray;">AND </span><span style="color:black;">Salary</span></code><br />
<code style="font-size:12px;"><span style="color:gray;">NOT </span><span style="color:blue;">IN </span><span style="color:gray;">(</span><span style="color:blue;">SELECT </span><span style="color:black;">Salary</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM </span><span style="color:black;">EmployeeRecord</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">WHERE </span><span style="color:black;">Salary </span><span style="color:gray;">&gt; </span><span style="color:black;">2000</span><span style="color:gray;">);</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">(Recomended)<br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">EmpNo</span><span style="color:gray;">, </span><span style="color:black;">EmpName<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">EmployeeRecord<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">Salery </span><span style="color:gray;">&gt; </span><span style="color:black;">1000<br />
</span><span style="color:blue;">EXCEPT<br />
SELECT </span><span style="color:black;">EmpNo</span><span style="color:gray;">, </span><span style="color:black;">EmpName<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">EmployeeRecord<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">Salery </span><span style="color:gray;">&gt; </span><span style="color:black;">2000<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">EmpName</span><span style="color:gray;">;</span></code></ul>
<p style="text-align:justify;">© Copyright 2000-2008<a title="Pinal Dave" href="http://www.pinaldave.com/"> Pinal Dave.</a> All Rights Reserved. <a href="http://blog.sqlauthority.com/">SQLAuthority.com</a></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
Posted in Best Practices, Database, Pinal Dave, Software Development, SQL, SQL Authority, SQL Coding Standards, SQL Documentation, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/1110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/1110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/1110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/1110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/1110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/1110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/1110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/1110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/1110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/1110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1110&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/09/24/sql-server-coding-standards-guidelines-part-2/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>
	</item>
		<item>
		<title>SQL SERVER &#8211; Guidelines and Coding Standards Part &#8211; 1</title>
		<link>http://blog.sqlauthority.com/2008/09/23/sql-server-coding-standards-guidelines-part-1/</link>
		<comments>http://blog.sqlauthority.com/2008/09/23/sql-server-coding-standards-guidelines-part-1/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 01:30:30 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=1107</guid>
		<description><![CDATA[
 Use &#8220;Pascal&#8221; notation for SQL server Objects Like Tables, Views, Stored Procedures. Also tables and views should have ending &#8220;s&#8221;.
Example:
UserDetails
Emails

 If you have big subset of table group than it makes sense to give prefix for this table group. Prefix should be separated by _. 
Example:
Page_ UserDetails
Page_ Emails

 Use following naming convention for Stored [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1107&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Use &#8220;Pascal&#8221; notation for SQL server Objects Like Tables, Views, Stored Procedures. Also tables and views should have ending &#8220;s&#8221;.</strong></li>
<p>Example:</p>
<p>UserDetails</p>
<p>Emails</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>If you have big subset of table group than it makes sense to give prefix for this table group. Prefix should be separated by _. </strong></li>
<p>Example:</p>
<p>Page_ UserDetails</p>
<p>Page_ Emails</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Use following naming convention for Stored Procedure. sp&lt;Application Name&gt;_[&lt;group name &gt;_]&lt;action type&gt;&lt;table name or logical instance&gt; Where action is: Get, Delete, Update, Write, Archive, Insert&#8230; i.e. verb </strong></li>
<p>Example:</p>
<p>spApplicationName_GetUserDetails</p>
<p>spApplicationName_UpdateEmails</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Use following Naming pattern for triggers: TR_&lt;TableName&gt;_&lt;action&gt;&lt;description&gt; </strong></li>
<p>Example:</p>
<p>TR_Emails_LogEmailChanges</p>
<p>TR_UserDetails_UpdateUserName</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Indexes : IX_&lt;tablename&gt;_&lt;columns separated by_&gt; </strong></li>
<p>Example:</p>
<p>IX_UserDetails_UserID</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Primary Key : PK_&lt;tablename&gt; </strong></li>
<p>Example:</p>
<p>PK_UserDetails</p>
<p>PK_ Emails</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Foreign Key : FK_&lt;tablename_1&gt;_&lt;tablename_2&gt; </strong></li>
<p>Example:</p>
<p>FK_UserDetails_Emails</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Default: DF_&lt;table name&gt;_&lt;column name&gt; </strong></li>
<p>Example:</p>
<p>DF_ UserDetails _UserName</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Normalize Database structure based on <strong>3<sup>rd</sup> Normalization Form</strong>. Normalization is the process of designing a data model to efficiently store data in a database. (<a href="http://blog.sqlauthority.com/2007/11/26/sql-server-rules-of-third-normal-form-and-normalization-advantage-3nf/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Avoid use of <strong>SELECT *</strong> in SQL queries. Instead practice writing required <strong>column</strong> names after <strong>SELECT</strong> statement.</li>
<p>Example:</p>
<p><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">Username</span><span style="color:gray;">, </span><span style="color:black;">Password<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">UserDetails</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Avoid using temporary tables and derived tables as it uses more disks I/O. Instead use <strong>CTE (Common Table Expression); </strong>its scope is limited to the next statement in SQL query. (<a href="http://blog.sqlauthority.com/2007/06/11/sql-server-2005-t-sql-paging-query-technique-comparison-over-and-row_number-cte-vs-derived-table/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>SET NOCOUNT ON</strong> at the beginning of SQL Batches, Stored Procedures and Triggers. This improves the performance of Stored Procedure. (<a href="http://blog.sqlauthority.com/2006/11/30/sql-server-cursor-to-process-tables-in-database-with-static-prefix-and-date-created/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Properly <strong>format</strong> SQL queries using indents.</li>
<p>Example: <em><strong>Wrong</strong> Format</em></p>
<p><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">Username</span><span style="color:gray;">, </span><span style="color:black;">Password </span><span style="color:blue;">FROM </span><span style="color:black;">UserDetails ud </span><span style="color:blue;">INNER JOIN </span><span style="color:black;">Employee e </span><span style="color:blue;">ON </span><span style="color:black;">e.EmpID </span><span style="color:blue;">= </span><span style="color:black;">ud.UserID</span></code></p>
<p>Example: <em><strong>Correct</strong> Format</em></p>
<p><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">Username</span><span style="color:gray;">, </span><span style="color:black;">Password</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM </span><span style="color:black;">UserDetails ud</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">INNER JOIN </span><span style="color:black;">Employee e </span><span style="color:blue;">ON </span><span style="color:black;">e.EmpID </span><span style="color:blue;">= </span><span style="color:black;">ud.UserID</span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Practice writing Upper Case for all SQL keywords.</li>
<p>Example:</p>
<p>SELECT, UPDATE, INSERT, WHERE, INNER JOIN, AND, OR, LIKE.</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> There must be <strong>PRIMARY KEY</strong> in all the tables of database with column name ID. It is common practice to use Primary Key as <strong>IDENTITY</strong> column.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> If &#8220;One Table&#8221; references &#8220;Another Table&#8221; than the column name used in reference should use the following rule :</li>
<p><strong>Column of Another Table : &lt;OneTableName&gt; ID</strong></p>
<p>Example:</p>
<p>If User table references Employee table than the column name used in reference should be <strong>UserID</strong> where User is table name and ID primary column of User table and UserID is reference column of Employee table.</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Columns with <strong>Default value</strong> constraint should not allow NULLs.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Practice using <strong>PRIMARY</strong> key in <strong>WHERE</strong> condition of <strong>UPDATE</strong> or <strong>DELETE</strong> statements as this will avoid error possibilities.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Always create stored procedure in <strong>same database</strong> where its relevant table exists otherwise it will reduce network performance.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Avoid server-side Cursors</strong> as much as possible, instead use SELECT statement. If you need to use cursor then replace it with WHILE loop (or read next suggestion).</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Instead of using <strong>LOOP</strong> to insert data from Table B to Table A, try to use <strong>SELECT</strong> statement with <strong>INSERT</strong> statement. (<a href="http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/">Read More Here</a>)</li>
<p><code style="font-size:12px;"><span style="color:blue;">INSERT INTO TABLE </span><span style="color:black;">A </span><span style="color:gray;">(</span><span style="color:black;">column1</span><span style="color:gray;">, </span><span style="color:black;">column2</span><span style="color:gray;">)</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">column1</span><span style="color:gray;">, </span><span style="color:black;">column2</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">FROM TABLE </span><span style="color:black;">B</span></code><br />
<code style="font-size:12px;"><span style="color:blue;">WHERE </span><span style="color:black;">.... </span></code></ul>
<ul class="unIndentedList" style="text-align:justify;">
<li><strong>Avoid using spaces within the name of database objects</strong>; this may create issues with front-end data access tools and applications. If you need spaces in your database object name then will accessing it surround the database object name with square brackets.</li>
<p>Example:</p>
<p>[Order Details]</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not use <strong>reserved words</strong> for naming database objects, as that can lead to some unpredictable situations. (<a href="http://blog.sqlauthority.com/2007/04/09/sql-server-2005-reserved-keywords/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Practice writing comments</strong> in stored procedures, triggers and SQL batches, whenever something is not very obvious, as it won&#8217;t impact the performance.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not use <strong>wild card characters</strong> at the beginning of word while search using LIKE keyword as it results in Index scan.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> <strong>Indent code</strong> for better readability. (<a href="http://blog.sqlauthority.com/2008/02/26/sql-server-select-1-vs-select-an-interesting-observation/">Example</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> While using <strong>JOINs</strong> in your SQL query always <strong>prefix column name</strong> with the table name. (<a href="http://blog.sqlauthority.com/2008/08/02/sql-server-effect-of-order-of-join-in-query/">Example</a>). If additionally require then prefix Table name with ServerName, DatabaseName, DatabaseOwner. (<a href="http://blog.sqlauthority.com/2007/06/26/sql-server-explanation-and-example-four-part-name/">Example</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Default constraint must be defined at the <strong>column level</strong>. All other constraints must be defined at the <strong>table level</strong>. (<a href="http://blog.sqlauthority.com/2008/09/08/sql-server-%e2%80%93-2008-creating-primary-key-foreign-key-and-default-constraint/">Read More Here</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Avoid using rules of database objects instead use <strong>constraints</strong>.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Do not use the <strong>RECOMPILE</strong> option for Stored Procedure as it reduces the performance.</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Always put the <strong>DECLARE</strong> statements at the starting of the code in the stored procedure. This will make the query optimizer to reuse query plans. (<a href="http://blog.sqlauthority.com/2007/04/11/sql-server-udf-user-defined-function-to-extract-only-numbers-from-string/">Example</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Put the <strong>SET</strong> statements in beginning (after DECLARE) before executing code in the stored procedure. (<a href="http://blog.sqlauthority.com/2007/04/11/sql-server-udf-user-defined-function-to-extract-only-numbers-from-string/">Example</a>)</li>
</ul>
<ul class="unIndentedList" style="text-align:justify;">
<li> Use <strong>BEGIN&#8230;END</strong> blocks only when multiple statements are present within a conditional code segment. (<a href="http://blog.sqlauthority.com/2007/11/28/sql-server-correct-syntax-for-stored-procedure-sp/">Read More Here</a>)</li>
</ul>
<p style="text-align:justify;">© Copyright 2000-2008<a title="Pinal Dave" href="http://www.pinaldave.com/"> Pinal Dave.</a> All Rights Reserved. <a href="http://blog.sqlauthority.com/">SQLAuthority.com</a></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
Posted in Best Practices, Database, Pinal Dave, Software Development, SQL, SQL Authority, SQL Coding Standards, SQL Constraint and Keys, SQL Documentation, SQL Index, SQL Joins, SQL Performance, SQL Query, SQL Scripts, SQL Server, SQL Stored Procedure, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/1107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/1107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/1107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/1107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/1107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/1107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/1107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/1107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/1107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/1107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=1107&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/09/23/sql-server-coding-standards-guidelines-part-1/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; Introduction to Policy Management &#8211; Enforcing Rules on SQL Server</title>
		<link>http://blog.sqlauthority.com/2008/06/13/sql-server-2008-introduction-to-policy-management-enforcing-rules-on-sql-server/</link>
		<comments>http://blog.sqlauthority.com/2008/06/13/sql-server-2008-introduction-to-policy-management-enforcing-rules-on-sql-server/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 01:30:03 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Policy Management]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=644</guid>
		<description><![CDATA[I have previous written article about SQL SERVER Database Coding Standards and Guidelines Complete List Download. I just received question from one of the blog reader is there any way we can just prevent violation of company policy. Well Policy Management can come into handy in this scenario.
If our company policy is to create all [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=644&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I have previous written article about <strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/" target="_blank">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong>. I just received question from one of the blog reader is there any way we can just prevent violation of company policy. Well Policy Management can come into handy in this scenario.</p>
<p style="text-align:justify;">If our company policy is to create all the Stored Procedure  with prefix &#8216;usp&#8217; that developers should be just prevented to create Stored Procedure with any other prefix. Let us see small tutorial how to create conditions and policy which will prevent any future SP to be created with any other prefix.</p>
<p style="text-align:justify;">Let us first create condition which defines that name of the database object should start with &#8216;usp&#8217;.</p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/blogfolder/policy1.jpg" alt="" width="326" height="477" /></p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/blogfolder/policy2.jpg" target="_blank"><img src="http://www.pinaldave.com/blogfolder/policy2s.jpg" alt="" width="500" height="355" /></a></p>
<p style="text-align:justify;">Now create policy for all the Stored Procedure of the database and assign previously created condition of naming convention to all the Stored Procedure of the database.</p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/blogfolder/policy3.jpg" alt="" width="344" height="479" /></p>
<p style="text-align:justify;">Make sure that Policy is enabled.</p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/blogfolder/policy4.jpg" target="_blank"><img src="http://www.pinaldave.com/blogfolder/policy4s.jpg" alt="" width="500" height="421" /></a></p>
<p style="text-align:justify;">Now try to create Stored Procedure with incorrect name. It will not let you create it but will create error.</p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/blogfolder/policy5.jpg" alt="" width="550" height="327" /></p>
<p style="text-align:justify;">If you try to create Stored Procedure prefixed with &#8216;usp&#8217; it will create it successfully.</p>
<p style="text-align:justify;"><img src="http://www.pinaldave.com/blogfolder/policy6.jpg" alt="" width="332" height="173" /></p>
<p style="text-align:justify;">Policy Management is very detailed subject and I will write more tutorial about this subject in future.</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>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/644/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/644/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/644/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/644/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=644&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/06/13/sql-server-2008-introduction-to-policy-management-enforcing-rules-on-sql-server/feed/</wfw:commentRss>
		<slash:comments>3</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/blogfolder/policy1.jpg" medium="image" />

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

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

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

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

		<media:content url="http://www.pinaldave.com/blogfolder/policy6.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Four Basic SQL Statements &#8211; SQL Operations</title>
		<link>http://blog.sqlauthority.com/2008/05/13/sql-server-four-basic-sql-statements-sql-operations/</link>
		<comments>http://blog.sqlauthority.com/2008/05/13/sql-server-four-basic-sql-statements-sql-operations/#comments</comments>
		<pubDate>Tue, 13 May 2008 01:30:17 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=602</guid>
		<description><![CDATA[There are four basic SQL Operations or SQL Statements.
SELECT &#8211; This statement selects data from database tables.
UPDATE &#8211; This statement updates existing data into database tables.
INSERT &#8211; This statement inserts new data into database tables.
DELETE &#8211; This statement deletes existing data from database tables.
If you want complete syntax for this four basic statement, please download [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=602&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">There are four basic SQL Operations or SQL Statements.</p>
<p style="text-align:justify;"><strong>SELECT</strong> &#8211; This statement selects data from database tables.</p>
<p style="text-align:justify;"><strong>UPDATE</strong> &#8211; This statement updates existing data into database tables.</p>
<p style="text-align:justify;"><strong>INSERT</strong> &#8211; This statement inserts new data into database tables.</p>
<p style="text-align:justify;"><strong>DELETE</strong> &#8211; This statement deletes existing data from database tables.</p>
<p style="text-align:justify;">If you want complete syntax for this four basic statement, please download FAQ (PDF) from <strong><a href="http://blog.sqlauthority.com/2008/04/28/sql-server-download-faq-sheet-sql-server-in-one-page/" target="_blank">SQL SERVER &#8211; Download FAQ Sheet &#8211; SQL Server in One Page</a></strong></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>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/602/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/602/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/602/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/602/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/602/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=602&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/05/13/sql-server-four-basic-sql-statements-sql-operations/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>
	</item>
		<item>
		<title>SQL SERVER &#8211; Add Column With Default Column Constraint to Table</title>
		<link>http://blog.sqlauthority.com/2008/03/19/sql-server-add-column-with-default-column-constraint-to-table/</link>
		<comments>http://blog.sqlauthority.com/2008/03/19/sql-server-add-column-with-default-column-constraint-to-table/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 01:30:38 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></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://sqlauthority.wordpress.com/?p=541</guid>
		<description><![CDATA[Just a day ago while working with database Jr. Developer asked me question how to add column along with column constraint. He also wanted to specify the name of the constraint. The newly added column should not allow NULL value. He requested my help as he thought he might have to write many lines to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=541&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Just a day ago while working with database Jr. Developer asked me question how to add column along with column constraint. He also wanted to specify the name of the constraint. The newly added column should not allow NULL value. He requested my help as he thought he might have to write many lines to achieve what was requested.</p>
<p style="text-align:justify;">It is very easy to add column and specify default constraint. I have seen many examples where constraint name is not specified, if constraint name is not specified SQL Server will generate unique name for itself. I prefer to specify my constraint name as per my coding standards. You can read my coding standard here : <strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/" target="_blank">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong></p>
<p><code style="font-size:12px;"><span style="color:blue;">ALTER TABLE </span><span style="color:black;">TestTable<br />
</span><span style="color:blue;">ADD </span><span style="color:black;">NewCol </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:blue;">CONSTRAINT </span><span style="color:black;">DF_TestTable_NewCol </span><span style="color:blue;">DEFAULT </span><span style="color:red;">'' </span><span style="color:gray;">NOT NULL<br />
</span><span style="color:black;">GO</span></code></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/541/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/541/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/541/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/541/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=541&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2008/03/19/sql-server-add-column-with-default-column-constraint-to-table/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>SQLAuthority News &#8211; Best Articles on SQLAuthority.com</title>
		<link>http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/</link>
		<comments>http://blog.sqlauthority.com/2007/11/04/sqlauthority-news-best-articles-on-sqlauthoritycom/#comments</comments>
		<pubDate>Sun, 04 Nov 2007 14:00:25 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Cursor]]></category>
		<category><![CDATA[SQL DateTime]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Humor]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBCC]]></category>
		<category><![CDATA[SQL Stored Procedure]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Trigger]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

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

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/11/03/sqlauthority-news-best-sqlauthority-articles-on-other-popular-sites/</guid>
		<description><![CDATA[Best SQLAuthority Articles on Other Popular Sites
SQL SERVER &#8211; UDF vs. Stored Procedures and Having vs. WHERE (SQL Server Magazine)
SQL SERVER &#8211; Pre-Code Review Tips &#8211; Tips For Enforcing Coding Standards (dotnetslackers.com)
Reference : Pinal Dave (http://blog.SQLAuthority.com)
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=394&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3 style="text-align:justify;">Best SQLAuthority Articles on Other Popular Sites</h3>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/10/10/sql-server-udf-vs-stored-procedures-and-having-vs-where/">SQL SERVER &#8211; UDF vs. Stored Procedures and Having vs. WHERE <strong>(SQL Server Magazine)</strong></a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/10/12/sql-server-pre-code-review-tips-tips-for-enforcing-coding-standards/">SQL SERVER &#8211; Pre-Code Review Tips &#8211; Tips For Enforcing Coding Standards <strong>(dotnetslackers.com)</strong></a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/394/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/394/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/394/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=394&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/11/03/sqlauthority-news-best-sqlauthority-articles-on-other-popular-sites/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>SQLAuthority News &#8211; Best Downloads on SQLAuthority.com</title>
		<link>http://blog.sqlauthority.com/2007/11/02/sqlauthority-news-best-downloads-on-sqlauthoritycom/</link>
		<comments>http://blog.sqlauthority.com/2007/11/02/sqlauthority-news-best-downloads-on-sqlauthoritycom/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 14:00:01 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Data Warehousing]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Interview Questions and Answers]]></category>
		<category><![CDATA[SQL Query]]></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/2007/11/02/sqlauthority-news-best-downloads-on-sqlauthoritycom/</guid>
		<description><![CDATA[Best Downloads on SQLAuthority.com
SQL SERVER &#8211; Query Analyzer Shortcuts
SQL Server Interview Questions and Answers Complete List Download
SQL SERVER &#8211; Download SQL Server Management Studio Keyboard Shortcuts (SSMS Shortcuts)
SQL SERVER Database Coding Standards and Guidelines Complete List Download
SQL SERVER &#8211; Data Warehousing Interview Questions and Answers Complete List Download
Reference : Pinal Dave (http://blog.SQLAuthority.com)
    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=393&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3 style="text-align:justify;">Best Downloads on SQLAuthority.com</h3>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/01/20/sql-server-query-analyzer-shortcuts/">SQL SERVER &#8211; Query Analyzer Shortcuts</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/">SQL Server Interview Questions and Answers Complete List Download</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/05/04/sql-server-download-sql-server-management-studio-keyboard-shortcuts-ssms-shortcuts/">SQL SERVER &#8211; Download SQL Server Management Studio Keyboard Shortcuts (SSMS Shortcuts)</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2007/07/29/sql-server-data-warehousing-interview-questions-and-answers-complete-list-download/">SQL SERVER &#8211; Data Warehousing Interview Questions and Answers Complete List Download</a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/393/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/393/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/393/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/393/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/393/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=393&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/11/02/sqlauthority-news-best-downloads-on-sqlauthoritycom/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; Pre-Code Review Tips &#8211; Tips For Enforcing Coding Standards</title>
		<link>http://blog.sqlauthority.com/2007/10/12/sql-server-pre-code-review-tips-tips-for-enforcing-coding-standards/</link>
		<comments>http://blog.sqlauthority.com/2007/10/12/sql-server-pre-code-review-tips-tips-for-enforcing-coding-standards/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 14:00:31 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/10/12/sql-server-pre-code-review-tips-tips-for-enforcing-coding-standards/</guid>
		<description><![CDATA[Each organization has its own coding standards and enforcement rules. It is sometime difficult for DBAs to change code following code review, as it may affect many different layers of the application. In large organizations, many stored procedures are written and modified every day. It is smart to keep watch on all stored procedures, at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=386&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">Each organization has its own coding standards and enforcement rules. It is sometime difficult for DBAs to change code following code review, as it may affect many different layers of the application. In large organizations, many stored procedures are written and modified every day. It is smart to keep watch on all stored procedures, at frequent intervals, before code comes to final code review. Pre-code reviewing in this manner will save lots of time. I run a few scripts every day to check the status of the all stored procedures on our development server. Doing so gives me a good indication about which stored procedures are not up to coding standards.</p>
<h3 style="text-align:justify;"><strong>Read my complete article <a href="http://dotnetslackers.com/articles/sql/SQLServerPreCodeReviewTips.aspx" target="_blank">SQL Server Pre-Code Review Tips</a></strong></h3>
<p style="text-align:justify;">Read <a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/" target="_blank">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></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>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/386/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/386/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/386/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/386/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/386/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=386&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/10/12/sql-server-pre-code-review-tips-tips-for-enforcing-coding-standards/feed/</wfw:commentRss>
		<slash:comments>3</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; Recovery Models and Selection</title>
		<link>http://blog.sqlauthority.com/2007/06/13/sql-server-recovery-models-and-selection/</link>
		<comments>http://blog.sqlauthority.com/2007/06/13/sql-server-recovery-models-and-selection/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 14:00:02 +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 Coding Standards]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Documentation]]></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>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/13/sql-server-recovery-models-and-selection/</guid>
		<description><![CDATA[SQL Server offers three recovery models: full recovery, simple recovery and bulk-logged recovery. The recovery models determine how much data loss is acceptable and determines whether and how transaction logs can be backed up.
Select Simple Recovery Model if:
* Your data is not critical.
* Losing all transactions since the last full or differential backup is not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=73&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">SQL Server offers three recovery models: <em>full recovery, simple recovery </em>and <em>bulk-logged recovery</em>. The recovery models determine how much data loss is acceptable and determines whether and how transaction logs can be backed up.</p>
<p style="text-align:justify;">Select <strong>Simple Recovery</strong> Model if:<br />
* Your data is not critical.<br />
* Losing all transactions since the last full or differential backup is not an issue.<br />
* Data is derived from other data sources and is easily recreated.<br />
* Data is static and does not change often.</p>
<p style="text-align:justify;">Select <strong>Bulk-Logged Recovery</strong> Model if:<br />
* Data is critical, but logging large data loads bogs down the system.<br />
* Most bulk operations are done off hours and do not interfere<br />
with normal transaction processing.<br />
* You need to be able to recover to a point in time.</p>
<p style="text-align:justify;">Select <strong>Full Recovery</strong> Model if:<br />
* Data is critical and no data can be lost.<br />
* You always need the ability to do a point-in-time recovery.<br />
* Bulk-logged activities are intermixed with normal transaction processing.<br />
* You are using replication and need the ability to resynchronize all<br />
databases involved in replication to a specific point in time.</p>
<p style="text-align:justify;">You can switch from any recovery model to another recovery model, but prior to or after the switch, you may need to issue additional transaction log or full backups to ensure you have a complete backup set.<br />
<code style="font-size:12px;"><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">Pubs </span><span style="color:blue;">SET </span><span style="color:black;">RECOVERY </span><span style="color:blue;">FULL<br />
</span><span style="color:black;">GO<br />
</span></code><br />
<a href="http://technet2.microsoft.com/WindowsServer/en/library/1d76e446-3122-4f2d-a696-1e260ae740f91033.mspx?mfr=true" target="_blank">Microsoft TechNet</a><br />
Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/73/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/73/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/73/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/73/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/73/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=73&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/06/13/sql-server-recovery-models-and-selection/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>
	</item>
		<item>
		<title>SQL SERVER Database Coding Standards and Guidelines Complete List Download</title>
		<link>http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/</link>
		<comments>http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 14:00:31 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/</guid>
		<description><![CDATA[Download SQL SERVER Database Coding Standards and Guidelines Complete List 
Just like my previous series of SQL Server Interview Questions and Answers Complete List Download, I have received many comments and emails regarding this series. Once I go through all the emails and comments, I will make summary of them and integrate them with my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=232&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><a href="http://www.pinaldave.com/Download/SQLServerCodingStardards.pdf" target="_blank"><strong>Download SQL SERVER Database Coding Standards and Guidelines Complete List </strong></a></p>
<p style="text-align:justify;">Just like my previous series of <strong><a href="http://www.pinaldave.com/Download/sqlinterview.pdf" target="_blank">SQL Server Interview Questions and Answers Complete List Download</a></strong>, I have received many comments and emails regarding this series. Once I go through all the emails and comments, I will make summary of them and integrate them with my series. I have also received emails asking me to create PDF for download. I have created that as well. Please feel free to download it and use it.</p>
<p style="text-align:justify;">Please ask me any questions you might have. Contact me if you are interested in writing mini series with me.</p>
<p style="text-align:justify;"><a href="http://www.pinaldave.com/download/SQLServerCodingStardards.pdf" target="_blank"><strong>Download SQL SERVER Database Coding Standards and Guidelines Complete List</strong></a></p>
<p style="text-align:justify;"><strong>Complete Series of </strong><strong>Database Coding Standards and Guidelines</strong><br />
<a href="http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/">SQL SERVER Database Coding Standards and Guidelines &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 2</a><br />
<strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong></p>
<p style="text-align:justify;"><strong><br />
Other popular Series</strong><br />
<strong><a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server Interview Questions and Answers Complete List Download</a></strong><br />
<strong><a href="http://blog.sqlauthority.com/2007/07/29/sql-server-data-warehousing-interview-questions-and-answers-complete-list-download/" target="_blank">SQL SERVER &#8211; Data Warehousing Interview Questions and Answers Complete List Download</a></strong></p>
<p style="text-align:justify;"><a href="http://www.digg.com/programming/SQLAuthority_com_Releases_SQL_SERVER_Database_Coding_Standards_Download" target="_blank">DIGG</a><br />
Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/232/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/232/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/232/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/232/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/232/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=232&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/feed/</wfw:commentRss>
		<slash:comments>68</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; Database Coding Standards and Guidelines &#8211; Part 2</title>
		<link>http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/</link>
		<comments>http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 14:00:41 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/</guid>
		<description><![CDATA[SQL Server Database Coding Standards and Guidelines &#8211; Part 2

Coding

Optimize      queries using the tools provided by SQL Server5
Do not use      SELECT *
Return      multiple result sets from one stored procedure to avoid trips from the      application [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=228&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h4><strong>SQL Server Database Coding Standards and Guidelines &#8211; Part 2<br />
</strong></h4>
<p><strong><span style="text-decoration:underline;">Coding</span></strong></p>
<ul>
<li>Optimize      queries using the tools provided by SQL Server<sup>5</sup></li>
<li>Do not use      SELECT *</li>
<li>Return      multiple result sets from one stored procedure to avoid trips from the      application server to SQL server</li>
<li>Avoid      unnecessary use of temporary tables
<ul>
<li>Use       &#8216;Derived tables&#8217; or CTE (Common Table Expressions) wherever possible, as       they perform better<sup>6</sup></li>
</ul>
</li>
<li>Avoid      using &lt;&gt; as a comparison operator
<ul>
<li>Use ID IN(1,3,4,5)       instead of ID &lt;&gt; 2</li>
</ul>
</li>
<li>Use SET      NOCOUNT ON at the beginning of stored procedures<sup>7</sup></li>
<li>Do not use      cursors or application loops to do inserts<sup>8</sup>
<ul>
<li>Instead,       use INSERT INTO</li>
</ul>
</li>
<li>Fully      qualify tables and column names in JOINs</li>
<li>Fully      qualify all stored procedure and table references in stored procedures.</li>
<li>Do not      define default values for parameters.
<ul>
<li>If a       default is needed, the front end will supply the value.</li>
</ul>
</li>
<li>Do not use      the RECOMPILE option for stored procedures.</li>
<li>Place all DECLARE      statements before any other code in the procedure.</li>
<li>Do not use      column numbers in the ORDER BY clause.</li>
<li>Do not use      GOTO.</li>
<li>Check the      global variable @@ERROR immediately after executing a data manipulation      statement (like INSERT/UPDATE/DELETE), so that you can rollback the      transaction if an error occurs
<ul>
<li>Or use       TRY/CATCH</li>
</ul>
</li>
<li>Do basic      validations in the front-end itself during data entry</li>
<li>Off-load      tasks, like string manipulations, concatenations, row numbering, case      conversions, type conversions etc., to the front-end applications if these      operations are going to consume more CPU cycles on the database server</li>
<li>Always use      a column list in your INSERT statements.
<ul>
<li>This       helps avoid problems when the table structure changes (like adding or       dropping a column).</li>
</ul>
</li>
<li>Minimize      the use of NULLs, as they often confuse front-end applications, unless the      applications are coded intelligently to eliminate NULLs or convert the      NULLs into some other form.
<ul>
<li>Any       expression that deals with NULL results in a NULL output.</li>
<li>The       ISNULL and COALESCE functions are helpful in dealing with NULL values.</li>
</ul>
</li>
<li>Do not use      the identitycol or rowguidcol.</li>
<li>Avoid the      use of cross joins, if possible.</li>
<li>When      executing an UPDATE or DELETE statement, use the primary key in the WHERE      condition, if possible. This reduces error possibilities.</li>
<li>Avoid      using TEXT or NTEXT datatypes for storing large textual data.<sup>9</sup>
<ul>
<li>Use the       maximum allowed characters of VARCHAR instead</li>
</ul>
</li>
<li>Avoid      dynamic SQL<strong> </strong>statements<strong> </strong>as much as possible.<sup>10</sup></li>
<li>Access      tables in the same order in your stored procedures and triggers      consistently.<sup>11</sup></li>
<li>Do not      call functions repeatedly<strong> </strong>within      your stored procedures, triggers, functions and batches.<sup>12</sup></li>
<li>Default      constraints must be defined at the column level.</li>
<li>Avoid      wild-card characters at the beginning of a word while searching using the      LIKE keyword, as these results in an index scan, which defeats the purpose      of an index.</li>
<li>Define all      constraints, other than defaults, at the table level.</li>
<li>When a      result set is not needed, use syntax that does not return a result set.<sup>13</sup></li>
<li>Avoid      rules, database level defaults that must be bound or user-defined data      types. While these are legitimate database constructs, opt for constraints      and column defaults to hold the database consistent for development and      conversion coding.</li>
<li>Constraints      that apply to more than one column must be defined at the table level.</li>
<li>Use the      CHAR data type for a column only when the column is non-nullable.<sup>14</sup></li>
<li>Do not use      white space in identifiers.</li>
<li>The RETURN      statement is meant for returning the execution status only, but not data.</li>
</ul>
<p><strong>Reference:</strong><br />
5) Use the graphical execution plan in Query Analyzer or SHOWPLAN_TEXT or SHOWPLAN_ALL commands to analyze your queries. Make sure your queries do an &#8220;Index seek&#8221; instead of an &#8220;Index scan&#8221; or a &#8220;Table scan.&#8221; A table scan or an index scan is a highly undesirable and should be avoided where possible.</p>
<p>6) Consider the following query to find the second highest offer price from the Items table:</p>
<pre><code style="font-size:12px;"><span style="color:blue;">SELECT MAX</span><span style="color:gray;">(</span><span style="color:black;">Price</span><span style="color:gray;">)
    </span><span style="color:blue;">FROM </span><span style="color:black;">Products
    </span><span style="color:blue;">WHERE </span><span style="color:black;">ID </span><span style="color:blue;">IN
    </span><span style="color:gray;">(
    </span><span style="color:blue;">SELECT TOP </span><span style="color:black;">2 ID
        </span><span style="color:blue;">FROM </span><span style="color:black;">Products
        </span><span style="color:blue;">ORDER BY </span><span style="color:black;">Price </span><span style="color:blue;">DESC
    </span><span style="color:gray;">)
            </span></code></pre>
<p>The same query can be re-written using a derived table, as shown below, and it performs generally twice as fast as the above query:</p>
<pre><code style="font-size:12px;"><span style="color:blue;">SELECT MAX</span><span style="color:gray;">(</span><span style="color:black;">Price</span><span style="color:gray;">)
    </span><span style="color:blue;">FROM
    </span><span style="color:gray;">(
    </span><span style="color:blue;">SELECT TOP </span><span style="color:black;">2 Price
        </span><span style="color:blue;">FROM </span><span style="color:black;">Products
        </span><span style="color:blue;">ORDER BY </span><span style="color:black;">Price </span><span style="color:blue;">DESC
    </span><span style="color:gray;">)
            </span></code></pre>
<p>7) This suppresses messages like &#8216;(1 row(s) affected)&#8217; after executing INSERT, UPDATE, DELETE and SELECT statements. Performance is improved due to the reduction of network traffic.</p>
<p>8) Try to avoid server side cursors as much as possible. Always stick to a &#8217;set-based approach&#8217; instead of a &#8216;procedural approach&#8217; for accessing and manipulating data. Cursors can often be avoided by using SELECT statements instead. If a cursor is unavoidable, use a WHILE loop instead. For a WHILE loop to replace a cursor, however, you need a column (primary key or unique key) to identify each row uniquely.</p>
<p>9) You cannot directly write or update text data using the INSERT or UPDATE statements. Instead, you have to use special statements like READTEXT, WRITETEXT and UPDATETEXT. So, if you don&#8217;t have to store more than 8KB of text, use the CHAR(8000) or VARCHAR(8000) datatype instead.</p>
<p>10) Dynamic SQL tends to be slower than static SQL, as SQL Server must generate an execution plan at runtime. IF and CASE statements come in handy to avoid dynamic SQL.</p>
<p>11) This helps to avoid deadlocks. Other things to keep in mind to avoid deadlocks are:</p>
<ul>
<li>Keep      transactions as short as possible.</li>
<li>Touch the      minimum amount of data possible during a transaction.</li>
<li>Never wait      for user input in the middle of a transaction.</li>
<li>Do not use      higher level locking hints or restrictive isolation levels unless they are      absolutely needed.</li>
</ul>
<p>12) You might need the length of a string variable in many places of your procedure, but don&#8217;t call the LEN function whenever it&#8217;s needed. Instead, call the LEN function once and store the result in a variable for later use.</p>
<p>13)</p>
<pre><code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">EXISTS (
    </span><span style="color:blue;">SELECT </span><span style="color:black;">1
        </span><span style="color:blue;">FROM </span><span style="color:black;">Products
        </span><span style="color:blue;">WHERE </span><span style="color:black;">ID </span><span style="color:blue;">= </span><span style="color:black;">50</span><span style="color:gray;">)
            </span></code></pre>
<p><strong>Instead Of:</strong></p>
<pre><code style="font-size:12px;"><span style="color:blue;">IF </span><span style="color:gray;">EXISTS (
    </span><span style="color:blue;">SELECT </span><span style="color:magenta;">COUNT</span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)
        </span><span style="color:blue;">FROM </span><span style="color:black;">Products
        </span><span style="color:blue;">WHERE </span><span style="color:black;">ID </span><span style="color:blue;">= </span><span style="color:black;">50</span><span style="color:gray;">)
            </span></code></pre>
<p>14) CHAR(100), when NULL, will consume 100 bytes, resulting in space wastage. Preferably, use VARCHAR(100) in this situation. Variable-length columns have very little processing overhead compared with fixed-length columns.</p>
<p><strong>Complete Series of </strong><strong>Database Coding Standards and Guidelines</strong><br />
<a href="http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/">SQL SERVER Database Coding Standards and Guidelines &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 2</a><br />
<strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/228/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/228/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/228/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/228/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/228/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=228&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/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; Database Coding Standards and Guidelines &#8211; Part 1</title>
		<link>http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/</link>
		<comments>http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/#comments</comments>
		<pubDate>Mon, 04 Jun 2007 14:00:22 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/</guid>
		<description><![CDATA[SQL Server Database Coding Standards and Guidelines &#8211; Part 1

Naming
Tables: Rules: Pascal notation; end with an ‘s&#8217;

Examples: Products, Customers
 Group related table names1

Stored Procs: Rules: sp&#60;App Name&#62;_[&#60;Group Name &#62;_]&#60;Action&#62;&#60;table/logical instance&#62;

 Examples: spOrders_GetNewOrders, spProducts_UpdateProduct

Triggers: Rules: TR_&#60;TableName&#62;_&#60;action&#62;

Examples: TR_Orders_UpdateProducts
Notes: The use of triggers is discouraged

Indexes: Rules: IX_&#60;TableName&#62;_&#60;columns separated by _&#62;

 Examples: IX_Products_ProductID

Primary Keys: Rules: PK_&#60;TableName&#62;

 Examples: PK_Products

Foreign Keys: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=227&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h4 style="text-align:justify;"><strong>SQL Server Database Coding Standards and Guidelines &#8211; Part 1<br />
</strong></h4>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">Naming</span></strong></p>
<p style="text-align:justify;"><strong>Tables:</strong> Rules: Pascal notation; end with an ‘s&#8217;</p>
<ul style="text-align:justify;">
<li>Examples: Products, Customers</li>
<li> Group related table names<sup>1</sup></li>
</ul>
<p style="text-align:justify;"><strong>Stored Procs: </strong>Rules: sp&lt;App Name&gt;_[&lt;Group Name &gt;_]&lt;Action&gt;&lt;table/logical instance&gt;</p>
<ul style="text-align:justify;">
<li> Examples: spOrders_GetNewOrders, spProducts_UpdateProduct</li>
</ul>
<p style="text-align:justify;"><strong>Triggers: </strong>Rules: TR_&lt;TableName&gt;_&lt;action&gt;</p>
<ul style="text-align:justify;">
<li>Examples: TR_Orders_UpdateProducts</li>
<li>Notes: The use of triggers is discouraged</li>
</ul>
<p style="text-align:justify;"><strong>Indexes:</strong> Rules: IX_&lt;TableName&gt;_&lt;columns separated by _&gt;</p>
<ul style="text-align:justify;">
<li> Examples: IX_Products_ProductID</li>
</ul>
<p style="text-align:justify;"><strong>Primary Keys:</strong> Rules: PK_&lt;TableName&gt;</p>
<ul style="text-align:justify;">
<li> Examples: PK_Products</li>
</ul>
<p style="text-align:justify;"><strong>Foreign Keys:</strong> Rules: FK_&lt;TableName1&gt;_&lt;TableName2&gt;</p>
<ul style="text-align:justify;">
<li> Example: FK_Products_Orderss</li>
</ul>
<p style="text-align:justify;"><strong>Defaults:</strong> Rules: DF_&lt;TableName&gt;_&lt;ColumnName&gt;</p>
<ul style="text-align:justify;">
<li> Example: DF_Products_Quantity</li>
</ul>
<p style="text-align:justify;"><strong>Columns:</strong> If a column references another table&#8217;s column, name it &lt;table name&gt;ID</p>
<ul style="text-align:justify;">
<li> Example: The Customers table has an ID column</li>
<li> The Orders table should have a CustomerID column</li>
</ul>
<p style="text-align:justify;"><strong>General Rules:</strong></p>
<ul style="text-align:justify;">
<li>Do not use spaces in the name of database objects
<ul>
<li> Do not use SQL keywords as the name of database objects</li>
<li> In cases where this is necessary, surround the</li>
</ul>
</li>
<li> object name with brackets, such as [Year]</li>
<li> Do not prefix stored procedures with ‘sp_&#8217;<sup>2</sup></li>
<li>Prefix table names with the owner name<sup>3</sup></li>
</ul>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">Structure</span></strong></p>
<ul class="unIndentedList" style="text-align:justify;">
<li>Each table      must have a primary key
<ul>
<li>In most       cases it should be an IDENTITY column named ID</li>
</ul>
</li>
<li>Normalize      data to third normal form
<ul>
<li>Do not       compromise on performance to reach third normal form. Sometimes, a little       de-normalization results in better performance.</li>
</ul>
</li>
<li>Do not use      TEXT as a data type; use the maximum allowed characters of VARCHAR instead</li>
<li>In VARCHAR      data columns, do not default to NULL; use an empty string instead</li>
<li>Columns      with default values should not allow NULLs</li>
<li> As much as possible, create stored procedures on the same database as the main tables they will be accessing</li>
</ul>
<p style="text-align:justify;"><strong><span style="text-decoration:underline;">Formatting</span></strong></p>
<ul style="text-align:justify;">
<li>Use upper      case for all SQL keywords
<ul>
<li>SELECT,       INSERT, UPDATE, WHERE, AND, OR, LIKE, etc.</li>
</ul>
</li>
<li>Indent      code to improve readability</li>
<li>Comment      code blocks that are not easily understandable
<ul>
<li>Use       single-line comment markers(&#8211;)</li>
<li>Reserve       multi-line comments (/*.. ..*/) for blocking out sections of code</li>
</ul>
</li>
<li>Use single      quote characters to delimit strings.
<ul>
<li>Nest       single quotes to express a single quote or apostrophe within a string
<ul>
<li>For        example,<strong> </strong>SET @sExample =        &#8216;SQL&#8217;&#8217;s Authority&#8217;</li>
</ul>
</li>
</ul>
</li>
<li>Use      parentheses to increase readability
<ul>
<li>WHERE (color=&#8217;red&#8217;       AND (size = 1 OR size = 2))</li>
</ul>
</li>
<li>Use      BEGIN..END blocks only when multiple statements are present within a      conditional code segment.</li>
<li>Use one      blank line to separate code sections.</li>
<li>Use spaces      so that expressions read like sentences.
<ul>
<li>fillfactor       = 25, not fillfactor=25</li>
</ul>
</li>
<li>Format      JOIN operations using indents
<ul>
<li>Also, use       ANSI Joins instead of old style joins<sup>4</sup></li>
</ul>
</li>
<li>Place SET      statements before any executing code in the procedure.</li>
</ul>
<p style="text-align:justify;"><strong>Reference:</strong><br />
1) Group related table names:</p>
<p style="text-align:justify;">Products_USA<br />
Products_India<br />
Products_Mexico
</p>
<p style="text-align:justify;">2) The prefix sp_ is reserved for system stored procedures<strong> </strong>that ship with SQL Server. Whenever SQL Server encounters a procedure name starting with sp_, it first tries to locate the procedure in the master database, then it looks for any qualifiers (database, owner) provided, then it tries dbo as the owner. Time spent locating the stored procedure can be saved by avoiding the &#8220;sp_&#8221; prefix.</p>
<p style="text-align:justify;">3) This improves readability and avoids unnecessary confusion. Microsoft SQL Server Books Online states that qualifying table names with owner names helps in execution plan reuse, further boosting performance.</p>
<p style="text-align:justify;">4)<br />
<em>False code:</em><br />
SELECT *<br />
FROM Table1, Table2<br />
WHERE Table1.d = Table2.c</p>
<p style="text-align:justify;"><em>True code:</em><br />
SELECT *<br />
FROM Table1<br />
INNER JOIN Table2 ON Table1.d = Table2.c</p>
<p style="text-align:justify;"><strong>Complete Series of </strong><strong>Database Coding Standards and Guidelines</strong><br />
<a href="http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/">SQL SERVER Database Coding Standards and Guidelines &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 2</a><br />
<strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong><br />
Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/227/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/227/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/227/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=227&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/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 Database Coding Standards and Guidelines &#8211; Introduction</title>
		<link>http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/</link>
		<comments>http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 14:00:59 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[DBA]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/</guid>
		<description><![CDATA[I have received many many request to do another series since my series SQL Server Interview Questions and Answers Complete List Download.  I have created small series of Coding Standards and Guidelines, as this is the second most request I have received from readers. This document can be extremely long but I have limited [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=226&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">I have received many many request to do another series since my series <a href="http://blog.sqlauthority.com/2007/04/21/sql-server-interview-questions-and-answers-complete-list-download/" target="_blank">SQL Server Interview Questions and Answers Complete List Download</a>.  I have created small series of Coding Standards and Guidelines, as this is the second most request I have received from readers. This document can be extremely long but I have limited to very few pages as it is difficult to follow thousands of the rules. My experience says it is more productive developer and better code if coding standard has important fewer rules than lots of micro rules.</p>
<p style="text-align:justify;">Next two days I will be posting Database Coding Standards and Guidelines. This are the coding standards which I use in my company. There is extra addendum also, which I will be not posting here as that is specific to our company only. Please let me know if you think I have missed any important coding standard rules, I will accommodate them.</p>
<p style="text-align:justify;">Please feel free to contact me if any of you want to write mini series with me.</p>
<p style="text-align:justify;">
<p style="text-align:justify;"><strong>Complete Series of </strong><strong>Database Coding Standards and Guidelines</strong><br />
<a href="http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/">SQL SERVER Database Coding Standards and Guidelines &#8211; Introduction</a><br />
<a href="http://blog.sqlauthority.com/2007/06/04/sql-server-database-coding-standards-and-guidelines-part-1/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 1</a><br />
<a href="http://blog.sqlauthority.com/2007/06/05/sql-server-database-coding-standards-and-guidelines-part-2/">SQL SERVER &#8211; Database Coding Standards and Guidelines &#8211; Part 2</a><br />
<strong><a href="http://blog.sqlauthority.com/2007/06/06/sql-server-database-coding-standards-and-guidelines-complete-list-download/">SQL SERVER Database Coding Standards and Guidelines Complete List Download</a></strong></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/226/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/226/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/226/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=226&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/06/03/sql-server-database-coding-standards-and-guidelines-introduction/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; 64 bit Architecture and White Paper</title>
		<link>http://blog.sqlauthority.com/2007/04/14/sql-server-64-bit-architecture-and-white-paper/</link>
		<comments>http://blog.sqlauthority.com/2007/04/14/sql-server-64-bit-architecture-and-white-paper/#comments</comments>
		<pubDate>Sat, 14 Apr 2007 15:00:20 +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 Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Performance]]></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/2007/04/14/sql-server-64-bit-architecture-and-white-paper/</guid>
		<description><![CDATA[In supportability, manageability, scalability, performance, interoperability, and business intelligence, SQL Server 2005 provides far richer 64-bit support than its predecessor. This paper describes these enhancements. Read the original paper here. Following abstract is taken from the same paper. Another interesting article on 64-bit Computing with SQL Server 2005 is here.
The primary differences between the 64-bit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=120&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;">In supportability, manageability, scalability, performance, interoperability, and business intelligence, SQL Server 2005 provides far richer 64-bit support than its predecessor. This paper describes these enhancements. <a href="http://download.microsoft.com/download/a/4/7/a47b7b0e-976d-4f49-b15d-f02ade638ebe/Adv64BitEnv.doc" target="_blank">Read the original paper here</a>. Following abstract is taken from the same paper. Another interesting article on <a href="http://www.microsoft.com/sql/editions/64bit/overview.mspx" target="_blank">64-bit Computing with SQL Server 2005 is here</a>.</p>
<p style="text-align:justify;">The primary differences between the 64-bit and 32-bit versions of SQL Server 2005 are derived from the benefits of the underlying 64-bit architecture. Some of these are:</p>
<ul style="text-align:justify;">
<li>The 64-bit architecture offers a larger directly-addressable memory space. SQL Server 2005 (64-bit) is not bound by the memory limits of 32-bit systems. Therefore, more memory is available for performing complex queries and supporting essential database operations.</li>
<li>The 64-bit processor provides enhanced parallelism, thereby providing more linear scalability and support for up to 64 processors, and yielding stronger returns per processor as compared to 32-bit systems.</li>
<li>The improved bus architecture enhances performance by moving more data between cache and processors in shorter periods.</li>
<li>A larger on-die cache allows for faster completion of user requests and more efficient use of processor time.</li>
</ul>
<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>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/120/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/120/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/120/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/120/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/120/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=120&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/04/14/sql-server-64-bit-architecture-and-white-paper/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; SQL Server 2005 Samples and Sample Databases (February 2007)</title>
		<link>http://blog.sqlauthority.com/2007/02/24/sql-server-sql-server-2005-samples-and-sample-databases-february-2007/</link>
		<comments>http://blog.sqlauthority.com/2007/02/24/sql-server-sql-server-2005-samples-and-sample-databases-february-2007/#comments</comments>
		<pubDate>Sat, 24 Feb 2007 15:00:11 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/02/24/sql-server-2005-samples-and-sample-databases-february-2007/</guid>
		<description><![CDATA[The samples download provides over 100 samples for SQL Server 2005, demonstrating the following components:

Database Engine, including administration, data access, Full-Text Search, Common Language Runtime (CLR) integration, Server Management Objects (SMO), Service Broker, and XML
Analysis Services
Integration Services
Notification Services
Reporting Services
Replication

The samples databases downloads include the AdventureWorks sample online transaction processing (OLTP) database, the AdventureWorksDW sample data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=51&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><span>The <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&amp;displaylang=en" target="_blank">samples download</a> provides over 100 samples for SQL Server 2005, demonstrating the following components:</span></p>
<ul style="text-align:justify;">
<li>Database Engine, including administration, data access, Full-Text Search, Common Language Runtime (CLR) integration, Server Management Objects (SMO), Service Broker, and XML</li>
<li>Analysis Services</li>
<li>Integration Services</li>
<li>Notification Services</li>
<li>Reporting Services</li>
<li>Replication</li>
</ul>
<p style="text-align:justify;">The samples databases downloads include the AdventureWorks sample online transaction processing (OLTP) database, the AdventureWorksDW sample data warehouse, and the AdventureWorksAS sample projects which you can use to build the AdventureWorksAS BI database. These databases are used in the samples and in the code examples in the SQL Server 2005 Books Online. There is also a new sample database called AdventureWorksLT. This is a scaled-down sample database that those who are new to SQL Server will find easier to use and understand.</p>
<p style="text-align:justify;"><em>The text above is copied from MS Download Center.</em></p>
<p style="text-align:justify;"><a href="http://www.microsoft.com/downloads/details.aspx?familyid=e719ecf7-9f46-4312-af89-6ad8702e4e6e&amp;displaylang=en" target="_blank">Download here.</a></p>
<p>Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a>) </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/51/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/51/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=51&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/02/24/sql-server-sql-server-2005-samples-and-sample-databases-february-2007/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; Primary Key Constraints and Unique Key Constraints</title>
		<link>http://blog.sqlauthority.com/2007/02/05/sql-server-primary-key-constraints-and-unique-key-constraints/</link>
		<comments>http://blog.sqlauthority.com/2007/02/05/sql-server-primary-key-constraints-and-unique-key-constraints/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 15:00:29 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Coding Standards]]></category>
		<category><![CDATA[SQL Constraint and Keys]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Joins]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Security]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=38</guid>
		<description><![CDATA[Primary Key:
Primary Key enforces uniqueness of the column on which they are defined. Primary Key creates a clustered index on the column. Primary Key does not allow Nulls.
Create table with Primary Key:
CREATE TABLE Authors (
AuthorID INT NOT NULL PRIMARY KEY,
Name VARCHAR(100) NOT NULL
)
GO

Alter table with Primary Key:
ALTER TABLE Authors
ADD CONSTRAINT pk_authors PRIMARY KEY (AuthorID)
GO

Unique Key:
Unique [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=38&subd=sqlauthority&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="text-align:justify;"><strong>Primary Key:</strong><br />
Primary Key enforces uniqueness of the column on which they are defined. Primary Key creates a clustered index on the column. Primary Key does not allow Nulls.</p>
<p style="text-align:justify;"><em>Create table with Primary Key:</em><br />
<code style="font-size:12px;"><span style="color:blue;">CREATE TABLE </span><span style="color:black;">Authors </span><span style="color:gray;">(<br />
</span><span style="color:black;">AuthorID </span><span style="color:blue;">INT </span><span style="color:gray;">NOT NULL </span><span style="color:blue;">PRIMARY KEY</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;">) NOT NULL<br />
)<br />
</span><span style="color:black;">GO<br />
</span></code><em><br />
Alter table with Primary Key:</em><br />
<code style="font-size:12px;"><span style="color:blue;">ALTER TABLE </span><span style="color:black;">Authors<br />
</span><span style="color:blue;">ADD CONSTRAINT </span><span style="color:black;">pk_authors </span><span style="color:blue;">PRIMARY KEY </span><span style="color:gray;">(</span><span style="color:black;">AuthorID</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span></code><br />
<strong>Unique Key:</strong><br />
Unique Key enforces uniqueness of the column on which they are defined. Unique Key creates a non-clustered index on the column. Unique Key allows only one NULL Value.</p>
<p style="text-align:justify;"><em>Alter table to add unique constraint to column:</em><br />
<code style="font-size:12px;"><span style="color:blue;">ALTER TABLE </span><span style="color:black;">Authors </span><span style="color:blue;">ADD CONSTRAINT </span><span style="color:black;">IX_Authors_Name </span><span style="color:blue;">UNIQUE</span><span style="color:gray;">(</span><span style="color:black;">Name</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span></code><br />
Reference : <strong>Pinal Dave (</strong><a href="http://blog.SQLAuthority.com" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a>), BOL</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlauthority.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlauthority.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&blog=668536&post=38&subd=sqlauthority&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2007/02/05/sql-server-primary-key-constraints-and-unique-key-constraints/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>
	</item>
	</channel>
</rss>