<?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/"
	>

<channel>
	<title>Technology Blog by Ash Chuan &#187; Database</title>
	<atom:link href="http://www.ashchuan.com/blog/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ashchuan.com/blog</link>
	<description>On software, gadgets, programming and blogging</description>
	<lastBuildDate>Thu, 02 Feb 2012 22:47:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Overview of SQLCMD command in Microsoft SQL Server</title>
		<link>http://www.ashchuan.com/blog/2012/01/02/overview-of-sqlcmd-command-in-sql-server-2005/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=overview-of-sqlcmd-command-in-sql-server-2005</link>
		<comments>http://www.ashchuan.com/blog/2012/01/02/overview-of-sqlcmd-command-in-sql-server-2005/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 22:33:28 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[Select (SQL)]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=2044</guid>
		<description><![CDATA[Microsoft SQL Server provides a tool to connect to the SQL Server database to run SQL queries all from the command line. This is useful for database administrators who need to quickly connect to run a SQL command without having to start the SQL Server...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2012%2F01%2F02%2Foverview-of-sqlcmd-command-in-sql-server-2005%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2012%2F01%2F02%2Foverview-of-sqlcmd-command-in-sql-server-2005%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Microsoft SQL Server provides a tool to connect to the SQL Server database to run SQL queries all from the command line. This is useful for database administrators who need to quickly connect to run a SQL command without having to start the SQL Server Management Studio (SSMS).</p>
<p>In this example I will concentrate on 3 simple examples to give a quick overview of what you can do with SQLCMD. The first example shows you how to connect to a SQL Server database using the Windows Authentication. The second example shows you how to connect to SQL Server database using the SQL Authentication and finally the third example shows you how to run a simple SELECT query. All examples are based on SQL Server 2005.</p>
<p><strong>Connect to the master database using Windows Authentication</strong></p>
<div id="attachment_2045" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd1.png" rel="lightbox[2044]"><img class="size-medium wp-image-2045" title="Using sqlcmd with Windows Authentication" src="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd1-300x15.png" alt="Using sqlcmd to connect to SQL Server using Windows Authentication" width="300" height="15" /></a><p class="wp-caption-text">Using sqlcmd to connect to SQL Server using Windows Authentication</p></div>
<p>-E indicates Windows Authentication.<br />
-S the SQL Server name instance. In this example it is Merovingian.<br />
-d name of the database. In this example the database is master.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2635249250939971";
/* 300x250, created 10/02/08 */
google_ad_slot = "1990815382";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<p><strong>Connect to the master database using SQL Authentication</strong></p>
<div id="attachment_2046" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd_2.png" rel="lightbox[2044]"><img class="size-medium wp-image-2046" title="using sqlcmd to connect to sql server using sql authentication" src="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd_2-300x15.png" alt="using sqlcmd to connect to sql server using sql authentication" width="300" height="15" /></a><p class="wp-caption-text">using sqlcmd to connect to sql server using sql authentication</p></div>
<p>-S the SQL Server name instance. In this example it is Merovingian.<br />
-d name of the database. In this example the database is master.<br />
-U the username used to login to SQL Server using SQL Authentication.<br />
-P the password used to login to SQL Server using SQL Authentication.</p>
<p><strong>SELECT query using SQLCMD</strong></p>
<div id="attachment_2048" class="wp-caption aligncenter" style="width: 469px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd_3.png" rel="lightbox[2044]"><img class="size-full wp-image-2048" title="SELECT query using SQLCMD" src="http://www.ashchuan.com/blog/wp-content/uploads/2012/01/sqlcmd_3.png" alt="SELECT query using SQLCMD" width="459" height="378" /></a><p class="wp-caption-text">SELECT query using SQLCMD</p></div>
<p>In this example, we want to query the TOP 10 contacts displaying the first name and last name.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=111ffbdf-e378-41e8-a860-d51f5c0bc84d" alt="Enhanced by Zemanta" /></a></div>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2012/01/02/overview-of-sqlcmd-command-in-sql-server-2005/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2012/01/02/overview-of-sqlcmd-command-in-sql-server-2005/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2012/01/02/overview-of-sqlcmd-command-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How-to Snippet: SQL Server 2005 Internal error. Buffer provided to read column value is too small.</title>
		<link>http://www.ashchuan.com/blog/2011/06/24/how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small</link>
		<comments>http://www.ashchuan.com/blog/2011/06/24/how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 22:02:22 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[DBCC CHECKDB]]></category>
		<category><![CDATA[Hotfix]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Internal Error]]></category>
		<category><![CDATA[Service Pack 2]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=1145</guid>
		<description><![CDATA[Some of you may have come across this error message in SQL Server 2005. SQL Server 2005: &#8220;Internal error. Buffer provided to read column value is too small. Run DBCC CHECKDB to check for any corruption&#8221;. If you run a DBCC CHECKDB, it will return...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F06%2F24%2Fhow-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F06%2F24%2Fhow-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Some of you may have come across this error message in SQL Server 2005.  <em>SQL Server 2005: &#8220;Internal error. Buffer provided to read column value is too small. Run DBCC CHECKDB to check for any corruption&#8221;</em>.  If you run a DBCC CHECKDB, it will return without any errors.</p>
<p><strong>When do you see the error in SQL Server 2005?</strong></p>
<p>When you do a SELECT&#8230;INTO a temporary table.  Example:  SELECT * INTO #mytable FROM dbo.datatable</p>
<p>Note: where #mytable is the temporary table and dbo.datatable is the table in the database you are working on.</p>
<p><!--adsense--></p>
<p><strong>How do you resolve the error?</strong></p>
<p>This was issued Microsoft:<br />
This issue has been fixed in the Cumulative update package 2 for SQL Server 2005 Service Pack 2 (http://support.microsoft.com/kb/936305) as part of SQL Hotfix 50001299. Please install the more recent Cumulative update package 4 for SQL Server 2005 Service Pack 2 (http://support.microsoft.com/kb/941450) which contains this fix and more.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2011/06/24/how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2011/06/24/how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2011/06/24/how-to-snippet-sql-server-2005-internal-error-buffer-provided-to-read-column-value-is-too-small/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOW TO: PIVOT in SQL Server 2005 to produce cross tabulation</title>
		<link>http://www.ashchuan.com/blog/2011/06/08/how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation</link>
		<comments>http://www.ashchuan.com/blog/2011/06/08/how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 08:38:16 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cross tabulation]]></category>
		<category><![CDATA[PIVOT]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[Transact SQL]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=1128</guid>
		<description><![CDATA[There was no easy way to produce a cross tabulation in SQL Server 2000 but in SQL Server 2005, this is achievable using the PIVOT command. Here is a example on how to produce a cross tabulation in SQL Server 2005. In the example below,...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F06%2F08%2Fhow-to-pivot-in-sql-server-2005-to-produce-cross-tabulation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F06%2F08%2Fhow-to-pivot-in-sql-server-2005-to-produce-cross-tabulation%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There was no easy way to produce a cross tabulation in SQL Server 2000 but in SQL Server 2005, this is achievable using the PIVOT command.  Here is a example on how to produce a cross tabulation in SQL Server 2005.</p>
<p>In the example below, the first table, named EventResult contains the results for an athletic competition.  The second table is what we will produce and it&#8217;s the cross tabulation of the EventResult table.</p>
<div id="attachment_1129" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/sql_pivot1.png" rel="lightbox[1128]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/sql_pivot1-300x147.png" alt="PIVOT SQL Server 2005 to produce cross tabulation" title="sql_pivot1" width="300" height="147" class="size-medium wp-image-1129" /></a><p class="wp-caption-text">Cross tabulation in SQL Server 2005</p></div>
<p>The T-SQL example below shows you how to produce the cross tabulation mentioned earlier using the PIVOT command.</p>
<div id="attachment_1130" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql.png" rel="lightbox[1128]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql.png" alt="" title="pivot_tsql" width="299" height="230" class="size-full wp-image-1130" /></a><p class="wp-caption-text">T-SQL example using PIVOT command to produce cross tabulation</p></div>
<p>Explanation:  Let&#8217;s start with the sub-query within the T-SQL query.</p>
<p>What is being PIVOT are the values of the Event column, taking each value and making them into columns ([100m], [200m], [800m]) and each pivoted column will contain SUM(Time).</p>
<div id="attachment_1133" class="wp-caption aligncenter" style="width: 228px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql_subquery.png" rel="lightbox[1128]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql_subquery.png" alt="PIVOT sub-query" title="pivot_tsql_subquery" width="218" height="167" class="size-full wp-image-1133" /></a><p class="wp-caption-text">Sub-Query showing PIVOT in T-SQL</p></div>
<p><!--adsense--></p>
<p>The SELECT command highlighted in grey shows the result of the pivoted table as Name, [100m], [200m], [800m].</p>
<div id="attachment_1136" class="wp-caption aligncenter" style="width: 309px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql_2.png" rel="lightbox[1128]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2011/06/pivot_tsql_2.png" alt="PIVOT command in T-SQL" title="pivot_tsql_2" width="299" height="230" class="size-full wp-image-1136" /></a><p class="wp-caption-text">SELECT command showing the PIVOT column headers</p></div>
<p>It may look a little confusing at first glance but I suggest that you create the example in SQL Server 2005 and try out the example and you will see the relationship between the EventResult table, the PIVOT table (cross tabulation) and the T-SQL.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2011/06/08/how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2011/06/08/how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2011/06/08/how-to-pivot-in-sql-server-2005-to-produce-cross-tabulation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating indexed views in SQL Server 2005 &#8211; Quick Guide</title>
		<link>http://www.ashchuan.com/blog/2011/01/10/creating-indexed-views-in-sql-server-2005-quick-guide/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-indexed-views-in-sql-server-2005-quick-guide</link>
		<comments>http://www.ashchuan.com/blog/2011/01/10/creating-indexed-views-in-sql-server-2005-quick-guide/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 21:59:26 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Indexed Views]]></category>
		<category><![CDATA[Quick Guide]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=1006</guid>
		<description><![CDATA[Here&#8217;s a quick guide on how to create indexed views in SQL Server 2005. How do you create indexed views in SQL Server 2005? 1) Create a table in your database, e.g. CREATE TABLE [dbo].[TestTableSC] ( [ID] [INT] NOT NULL, [name] [varchar] (100) NULL, [description]...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F01%2F10%2Fcreating-indexed-views-in-sql-server-2005-quick-guide%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2011%2F01%2F10%2Fcreating-indexed-views-in-sql-server-2005-quick-guide%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div id="attachment_975" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sql2005.jpg" rel="lightbox[1006]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sql2005-300x143.jpg" alt="SQL Server 2005" title="sql2005" width="300" height="143" class="size-medium wp-image-975" /></a><p class="wp-caption-text">SQL Server 2005</p></div>
<p>Here&#8217;s a quick guide on how to create indexed views in SQL Server 2005.</p>
<p><strong>How do you create indexed views in SQL Server 2005?</strong></p>
<p>1) Create a table in your database, e.g.</p>
<p>CREATE TABLE [dbo].[TestTableSC] (<br />
 [ID]  [INT] NOT NULL,<br />
 [name]  [varchar] (100) NULL,<br />
 [description]  [varchar] (255) NULL<br />
)</p>
<p>2) SET ANSI_NULLS, ANSI_WARNINGS ON&#8230;.</p>
<p>SET NUMERIC_ROUNDABORT OFF;<br />
SET ANSI_PADDING,<br />
    ANSI_WARNINGS,<br />
    CONCAT_NULL_YIELDS_NULL,<br />
    ARITHABORT,<br />
    QUOTED_IDENTIFIER,<br />
    ANSI_NULLS ON;<br />
GO<br />
<span id="more-1006"></span></p>
<p>3) In you database create a view WITH SCHEMABINDING, e.g.</p>
<p>CREATE VIEW [dbo].[TestTableSCView] WITH SCHEMABINDING AS<br />
SELECT ID, name, description FROM dbo.TestTableSC</p>
<p>GO</p>
<p>4) Create a CLUSTERED INDEX</p>
<p>CREATE UNIQUE CLUSTERED INDEX TestTableSC_PKey<br />
     ON TestTableSCView(ID)<br />
GO</p>
<p>Here are the Gotchas on creating indexed views in SQL Server 2005</p>
<p>You can only create a SCHEMABINDING view when the base table is in the same database.  If the base table is in a different database or a linked server, you will get an error.</p>
<p>SQL Server does not allow SCHEMABINDING a view to a base table in a different database.</p>
<p>Example:</p>
<p>CREATE VIEW [dbo].[TestTableSCView2] WITH SCHEMABINDING AS<br />
SELECT ID, name, description FROM database1.dbo.TestTableSC</p>
<p>GO</p>
<p>You&#8217;ll get the error:</p>
<p>Cannot schema bind view &#8216;dbo.TestTableSCView2&#8242; because name &#8216;database1.dbo.TestTableSC&#8217; is invalid for schema binding.   Names must be in two-part format and an object cannot reference itself.</p>
<p><!--adsense--></p>
<p>That concludes the quick guide to creating indexed views in SQL Server 2005.</p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2011/01/10/creating-indexed-views-in-sql-server-2005-quick-guide/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2011/01/10/creating-indexed-views-in-sql-server-2005-quick-guide/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2011/01/10/creating-indexed-views-in-sql-server-2005-quick-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Mail deprecated in SQL Server 2005 64-bit</title>
		<link>http://www.ashchuan.com/blog/2010/12/07/sql-mail-deprecated-in-sql-server-2005-64-bit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sql-mail-deprecated-in-sql-server-2005-64-bit</link>
		<comments>http://www.ashchuan.com/blog/2010/12/07/sql-mail-deprecated-in-sql-server-2005-64-bit/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 10:37:34 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[dat]]></category>
		<category><![CDATA[DatabaseMail]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[SQL Server 2005 64-bit]]></category>
		<category><![CDATA[SQLMail]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=983</guid>
		<description><![CDATA[The legacy SQLMail support is no longer available in SQL Server 2005 64-bit. In lower version, i.e. SQL Server 2005 32-bit, SQL Mail is marked as a legacy functionality but you can still setup SQLMail and use it in your Stored Procedures. SQLMail has been...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F12%2F07%2Fsql-mail-deprecated-in-sql-server-2005-64-bit%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F12%2F07%2Fsql-mail-deprecated-in-sql-server-2005-64-bit%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div id="attachment_984" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sqlmail2005.jpg" rel="lightbox[983]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sqlmail2005-300x96.jpg" alt="SQLMail" title="sqlmail2005" width="300" height="96" class="size-medium wp-image-984" /></a><p class="wp-caption-text">SQLMail - Legacy in SQL Server 2005 64-bit</p></div>
<p>The legacy SQLMail support is no longer available in SQL Server 2005 64-bit.  In lower version, i.e. SQL Server 2005 32-bit, SQL Mail is marked as a legacy functionality but you can still setup SQLMail and use it in your Stored Procedures.  SQLMail has been superseded by DatabaseMail which does not require MAPI and the installation of Microsoft Outlook to run SQLMail.</p>
<div id="attachment_985" class="wp-caption aligncenter" style="width: 265px"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sqlmail2005_2.jpg" alt="Legacy SQLMail" title="sqlmail2005_2" width="255" height="197" class="size-full wp-image-985" /><p class="wp-caption-text">Legacy SQLMail in SQL Server 2005</p></div>
<p>In SQL Server 2005 64-bit we have been advised to use DatabaseMail.  This works perfectly for sending e-mails from SQL Server and it&#8217;s a whole lot easier when setting up DatabaseMail.  The only drawback is you cannot read e-mails from an Outlook mailbox like how you could with SQLMail.  Microsoft has not provided an alternative.  The only way is to use a third party solution if you want to read e-mails from a mailbox.</p>
<p>In my next post, I will write about a third party solution that will allow you to read e-mails from a mailbox and process the e-mails within SQL Server.</p>
<p><!--adsense--></p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2010/12/07/sql-mail-deprecated-in-sql-server-2005-64-bit/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2010/12/07/sql-mail-deprecated-in-sql-server-2005-64-bit/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2010/12/07/sql-mail-deprecated-in-sql-server-2005-64-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server 2005 Database Autogrowth option is a bug</title>
		<link>http://www.ashchuan.com/blog/2010/12/07/sql-server-2005-database-autogrowth-option-is-a-bug/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sql-server-2005-database-autogrowth-option-is-a-bug</link>
		<comments>http://www.ashchuan.com/blog/2010/12/07/sql-server-2005-database-autogrowth-option-is-a-bug/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 10:14:26 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[Transaction Log]]></category>
		<category><![CDATA[Unrestricted File Growth]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=974</guid>
		<description><![CDATA[When maintaining a SQL Server database, you have the option to select if you want to restrict the growth of a database or transaction log or give SQL Server the liberty to grow automatically without setting a restriction. You select unrestricted file growth when you...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F12%2F07%2Fsql-server-2005-database-autogrowth-option-is-a-bug%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F12%2F07%2Fsql-server-2005-database-autogrowth-option-is-a-bug%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div id="attachment_975" class="wp-caption aligncenter" style="width: 310px"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/sql2005-300x143.jpg" alt="SQL Server 2005" title="sql2005" width="300" height="143" class="size-medium wp-image-975" /><p class="wp-caption-text">SQL Server 2005</p></div>
<p>When maintaining a SQL Server database, you have the option to select if you want to restrict the growth of a database or transaction log or give SQL Server the liberty to grow automatically without setting a restriction.  You select unrestricted file growth when you know you have enough disk space to cope with the growth of the database or transaction log over a period of time.</p>
<p>Recently, we had to make adjustments to cater for a larger transaction log but we were stumped when the &#8220;Unrestricted File Growth&#8221; option radio button kept reverting back to the &#8220;Restricted File Growth (MB)&#8221; option and the size of 2,097,152 MB.  Every time I select the &#8220;Unrestricted File Growth&#8221; radio button and hit the save button, it reverts back to &#8220;Restricted File Growth (MB)&#8221;.</p>
<p><!--adsense--></p>
<p>I discovered from Microsoft that it is a bug but Microsoft refused to call it a &#8220;bug&#8221;.  Their explanation &#8211; there is a set limit of 2TB for &#8220;Unrestricted File Growth&#8221; for any database or transaction log.  The Restricted File Growth (MB) size of 2,097,152 MB is 2TB.  This means that the Restricted File Growth (MB) option is actually allowing auto growth until it reaches 2TB.  This also means they have also confused database administrators by providing the &#8220;Unrestricted File Growth&#8221; option which is not selectable in SQL Server 2005.</p>
<p>So if you wish to allow your SQL Server database or transaction log to grow without a limit, select &#8220;Restricted File Growth (MB)&#8221; option and allow the database or transaction log to grow until it reaches the 2TB limit.  That is the only work around for now.</p>
<p>See screenshot below. </p>
<div id="attachment_976" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/unrestrictedfilegrowth.jpg" rel="lightbox[974]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/12/unrestrictedfilegrowth-300x233.jpg" alt="SQL Server Autogrowth" title="unrestrictedfilegrowth" width="300" height="233" class="size-medium wp-image-976" /></a><p class="wp-caption-text">SQL Server 2005 Autogrowth</p></div>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2010/12/07/sql-server-2005-database-autogrowth-option-is-a-bug/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2010/12/07/sql-server-2005-database-autogrowth-option-is-a-bug/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2010/12/07/sql-server-2005-database-autogrowth-option-is-a-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Here&#8217;s a SQL Server Tip</title>
		<link>http://www.ashchuan.com/blog/2010/07/29/heres-a-sql-server-tip/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=heres-a-sql-server-tip</link>
		<comments>http://www.ashchuan.com/blog/2010/07/29/heres-a-sql-server-tip/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 23:03:20 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Management Studio]]></category>
		<category><![CDATA[Query]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=959</guid>
		<description><![CDATA[How many times have you asked this question when you run a query. How do I copy the query result with the column names into Microsoft Excel? In the SQL Server Management Studio, in the Tools menu, select Tools > Options > SQL Server >...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F07%2F29%2Fheres-a-sql-server-tip%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2010%2F07%2F29%2Fheres-a-sql-server-tip%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>How many times have you asked this question when you run a query.  How do I copy the query result with the column names into Microsoft Excel?</p>
<p>In the SQL Server Management Studio, in the Tools menu, select <strong>Tools > Options > SQL Server > Results to Grid</strong><em></p>
<p>Then check the <strong>Include column headers when copying or saving the results</strong> checkbox and click on OK.</p>
<p>That&#8217;s it.  The next time you run a query, copy the query result, paste in Excel and voila, the column names are pasted together with the data.</p>
<p><a href="http://www.ashchuan.com/blog/wp-content/uploads/2010/07/sqlwithcolumnname.png" rel="lightbox[959]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2010/07/sqlwithcolumnname-300x174.png" alt="" title="sqlwithcolumnname" width="300" height="174" class="aligncenter size-medium wp-image-961" /></a></p>
<p><!--adsense--></p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2010/07/29/heres-a-sql-server-tip/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2010/07/29/heres-a-sql-server-tip/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2010/07/29/heres-a-sql-server-tip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL xp_findnextmsg and xp_readmail</title>
		<link>http://www.ashchuan.com/blog/2009/11/15/sql-xp_findnextmsg-and-xp_readmail/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sql-xp_findnextmsg-and-xp_readmail</link>
		<comments>http://www.ashchuan.com/blog/2009/11/15/sql-xp_findnextmsg-and-xp_readmail/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 22:48:24 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[SQL Mail]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[xp_findnextmsg]]></category>
		<category><![CDATA[xp_readmail]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=936</guid>
		<description><![CDATA[If you use SQL mail, you can read the messages in the SQL inbox stack and do stuff with them. Recently I had to use SQL scripting to find messages in the SQL inbox, read the message, determine if it is a text or html...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2009%2F11%2F15%2Fsql-xp_findnextmsg-and-xp_readmail%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2009%2F11%2F15%2Fsql-xp_findnextmsg-and-xp_readmail%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you use SQL mail, you can read the messages in the SQL inbox stack and do stuff with them.  Recently I had to use SQL scripting to find messages in the SQL inbox, read the message, determine if it is a text or html email, then add the message to a table in the database.</p>
<p>This can be easily achieved using the xp_findnextmsg and xp_readmail procedures.  To strip the html tags from the email, I used a UDF (User Defined Function) written by the SQL guru of http://blog.sqlauthority.com.  Kudos to him for sharing the function.<br />
<span id="more-936"></span><br />
All SQL examples are shown below.</p>
<p>The xp_readmail example is written for SQL Server 2000, where there is a limit of varchar(8000) for data type varchar.  In SQL Server 2005, you can use varchar(max) which extends the limit.  You will see in my example I split email messages that are bigger than varchar(8000) when using xp_readmail.<br />
<!--adsense--><br />
<img src="http://www.ashchuan.com/blog/wp-content/uploads/2009/07/readmail.PNG" alt="readmail" title="readmail" class="alignnone size-full wp-image-937" /></p>
<p><img src="http://www.ashchuan.com/blog/wp-content/uploads/2009/07/readmail2.PNG" alt="readmail2" title="readmail2" class="alignnone size-full wp-image-938" /></p>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2009/11/15/sql-xp_findnextmsg-and-xp_readmail/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2009/11/15/sql-xp_findnextmsg-and-xp_readmail/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2009/11/15/sql-xp_findnextmsg-and-xp_readmail/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Server Integration Services is the new Data Transformation tool for SQL Server</title>
		<link>http://www.ashchuan.com/blog/2008/12/27/sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server</link>
		<comments>http://www.ashchuan.com/blog/2008/12/27/sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 09:40:42 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Data Transformation]]></category>
		<category><![CDATA[Data Transformation Services]]></category>
		<category><![CDATA[DTS]]></category>
		<category><![CDATA[DTS Designer Component]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Integration Services]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">http://www.ashchuan.com/blog/?p=719</guid>
		<description><![CDATA[I wrote this post months ago but didn&#8217;t get around to publish it. I know that SQL Server 2008 is now an available product but many of us are still using SQL Server 2005 and have created a lot Data Transformation Services (DTS) in the...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2008%2F12%2F27%2Fsql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2008%2F12%2F27%2Fsql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div align="center"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/12/business_intelligence.gif" alt="" title="business_intelligence" class="alignnone size-medium wp-image-720" /></div>
<p>I wrote this post months ago but didn&#8217;t get around to publish it.  I know that SQL Server 2008 is now an available product but many of us are still using SQL Server 2005 and have created a lot Data Transformation Services (DTS) in the past.</p>
<p>In SQL Server 2005, Microsoft replaced DTS with SQL Server Integration Services (SSIS).  The common work flow IDE that I am familiar with in SQL Server 2000 is now called SQL Server Business Intelligence Development Studio.  It is a Visual Studio 2005 development environment which allows the creation of Analysis projects, Integration Services projects and Reporting Services projects.<br />
<span id="more-719"></span><br />
However, all is not lost for SQL Server 2000 DTS packages.  SQL Server 2005 provides backward compatibility.  You can import existing DTS packages into SQL Server 2005 and run them like how you would in SQL Server 2000.   If you look at the SQL Server Management Studio (the replacement for Enterprise Manager), you will see that SQL Server 2005 provides legacy support for Maintenance Plans, DTS and SQL Mail.</p>
<div align="center">
<img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/12/ssms_1.gif" alt="" title="ssms_1" class="alignnone size-medium wp-image-721" /></div>
<p>If SQL Server 2005 supports legacy DTS then it means you can edit and make changes to existing DTS packages in SQL Server 2005.  To do that you have to download SQL Server 2000 DTS Designer Components and install it first.</p>
<p><!--adsense--></p>
<p>The DTS Designer Component has the familiar DTS interface you see in SQL Server 2000.  You can edit, run now or schedule the DTS to run as a scheduled job using the DTS Designer Component.  Migration of DTS to SSIS project is also catered for.  SQL 2005 provides a migration wizard.  Since the design of DTS is very different from SSIS, migration may not always be 100% successful.  Chances are the migration may not migrate all tasks successfully.  For tasks that fail to migrate properly, the suggestion is to create them in SSIS using the SSIS objects.</p>
<div align="center">
<img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/12/dts_designer.gif" alt="" title="dts_designer" class="alignnone size-medium wp-image-722" /></div>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2008/12/27/sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2008/12/27/sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2008/12/27/sql-server-integration-services-is-the-new-data-transformation-tool-for-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database Mail vs SQL Mail in SQL Server 2005</title>
		<link>http://www.ashchuan.com/blog/2008/10/29/database-mail-vs-sql-mail-in-sql-server-2005/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=database-mail-vs-sql-mail-in-sql-server-2005</link>
		<comments>http://www.ashchuan.com/blog/2008/10/29/database-mail-vs-sql-mail-in-sql-server-2005/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 22:20:32 +0000</pubDate>
		<dc:creator>ash</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[How-to Guide]]></category>
		<category><![CDATA[Database Mail]]></category>
		<category><![CDATA[SQL Mail]]></category>
		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://1275313070</guid>
		<description><![CDATA[SQL Mail was what one would use to send emails from SQL Server in the SQL Server 2000 version. But in SQL Server 2005, SQL Mail is considered legacy. Microsoft introduced a better email component called Database Mail for SQL Server 2005. In SQL Mail,...]]></description>
			<content:encoded><![CDATA[<!-- sphereit start --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2008%2F10%2F29%2Fdatabase-mail-vs-sql-mail-in-sql-server-2005%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ashchuan.com%2Fblog%2F2008%2F10%2F29%2Fdatabase-mail-vs-sql-mail-in-sql-server-2005%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<div align="center">
<a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/dbmail.gif" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/dbmail.gif" alt="" title="dbmail" class="alignnone size-medium wp-image-530" border="0" /></a>
</div>
<p>SQL Mail was what one would use to send emails from SQL Server in the SQL Server 2000 version.  But in SQL Server 2005, SQL Mail is considered legacy.  Microsoft introduced a better email component called Database Mail for SQL Server 2005.</p>
<p>In SQL Mail, you can run the xp_sendmail stored procedure to send an email from SQL Server 2000.  Here is an example of the xp_sendmail script.  </p>
<div align="center">
<a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail6.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail6.jpg" alt="" title="mail6" class="alignnone size-medium wp-image-534" border="0" /></a>
</div>
<p>I use a lot of xp_sendmail in my SQL script when I was developing applications in SQL Server 2000 and since migrating to SQL Server 2005, there are still the legacy SQL Mail scripts lurking in SQL Server 2005 which I have not migrated to using Database Mail.</p>
<p><strong>So why did Microsoft make the decision to move away from SQL Mail and introduce Database Mail?<br />
</strong><br />
<span id="more-523"></span></p>
<p>1.  SQL Mail was developed and runs in-process to SQL Server service.  This means if SQL Mail goes down, your SQL Server also goes down.  You don&#8217;t want this to happen on your production database because you will not have many happy users if that happens.</p>
<p>2.  To use SQL Mail you need to install the extended MAPI client component on your server.  How I usually do this is by installing Microsoft Outlook on the server.  This will install the MAPI client component.  Without MAPI, SQL Mail will not run.</p>
<p><strong>What are the advantages of using Database Mail?</strong></p>
<p>1.  Unlike SQL Mail, Database Mail runs outside SQL Server in a separate process.  So if Database Mail goes down, it will not bring down SQL Server.</p>
<p>2. Database Mail does not need Extended MAPI client components installed for it to run.</p>
<p><!--adsense--></p>
<p>3.  Database Mail can be configued with multiple SMTP accounts and with multiple profiles.  This increases the robustness of the system.  In a realtime environment, if one mail server goes down, Database Mail will still be able to send emails through the other configured SMTP accounts.</p>
<p>4.  In Database Mail, all mail events are logged and you can view the mail history.</p>
<p>5.  You can configure Database Mail to limit file sizes, disallowing large attachments and filtering of file extensions such as .exe or .bat</p>
<p><strong>Where do you enable Database Mail and SQL Mail in SQL Server 2005?</strong></p>
<p>You do it through SQL Server 2005 Surface Area Configuration shown below.  Click on Surface Area Configuration for Features.</p>
<div align="center"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail3a.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail3a.jpg" alt="" title="mail3a" class="alignnone size-medium wp-image-541" border="0" /></a></div>
<p>Tick Enable Database Mail Stored Procedures to enable Database Mail in SQL Server</p>
<div align="center">
<a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail1a.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail1a.jpg" alt="" title="mail1a" class="alignnone size-medium wp-image-539" border="0" /></a></div>
<p>Tick Enable SQL Mail Stored Procedures to enable SQL Mail in SQL Server</p>
<div align="center"><a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail2a.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail2a.jpg" alt="" title="mail2a" class="alignnone size-medium wp-image-540" border="0" /></a></div>
<p>Access Database Mail and SQL Mail and setup both in SQL Server Management Console, shown below.<br />
  Once that is setup, you can invoke Database Mail and SQL Mail to send emails and notification.</p>
<div align="center">
<a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail4.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail4.jpg" alt="" title="mail4" class="alignnone size-medium wp-image-527" border="0" /></a></div>
<div align="center">
<a href="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail5.jpg" rel="lightbox[523]"><img src="http://www.ashchuan.com/blog/wp-content/uploads/2008/10/mail5.jpg" alt="" title="mail5" class="alignnone size-medium wp-image-528" border="0" /></a></div>
<!-- sphereit end --><span style="margin-bottom:40px; border-bottom:none;"><a class="iconsphere" title="Sphere: Related Content" onclick="return Sphere.Widget.search('http://www.ashchuan.com/blog/2008/10/29/database-mail-vs-sql-mail-in-sql-server-2005/')" href="http://www.sphere.com/search?q=sphereit:http://www.ashchuan.com/blog/2008/10/29/database-mail-vs-sql-mail-in-sql-server-2005/">Sphere: Related Content</a></span><br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.ashchuan.com/blog/2008/10/29/database-mail-vs-sql-mail-in-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

