<?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 Bits and Bytes &#187; sandeverma</title>
	<atom:link href="http://blogs.circlesource.com/author/sandeverma/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.circlesource.com</link>
	<description>CircleSource Technical Talent ShowCase</description>
	<lastBuildDate>Thu, 10 Dec 2009 20:01:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AB-INITO MERGE SQL 2008</title>
		<link>http://blogs.circlesource.com/2009/01/19/sandeverma/</link>
		<comments>http://blogs.circlesource.com/2009/01/19/sandeverma/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 16:31:43 +0000</pubDate>
		<dc:creator>sandeverma</dc:creator>
				<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=117</guid>
		<description><![CDATA[
MERGE: Multitasking Economical Rapid Going Equations -&#62; Introduced in SQL 2008 as new feature. You would be thinking what abbreviation I have given to this MERGE keyword, but after a lot analysis I found this is the correct definition I can give it. As this performs multiple tasks at time like insert, update, delete in [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 1pt 1in; text-indent: 0.5in;"><strong></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 1pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><strong>MERGE: </strong>Multitasking Economical Rapid Going Equations -&gt; Introduced in SQL 2008 as new feature. You would be thinking what abbreviation I have given to this MERGE keyword, but after a lot analysis I found this is the correct definition I can give it. As this performs multiple tasks at time like insert, update, delete in a single statement. Economical, as it reduces some of the tedious work. One of the most important advantages of MERGE statement is that all the data is read and processed only once. This is quite an improvement in performance of database query.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 1pt;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>Before MERGE people used to write IF ELSE conditions to perform the task, which on performance basis not very efficient.<span style="mso-spacerun: yes;"> </span>For e.g.:</span></span></p>
<p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">&#8212; If data identifier (some column having unique value like primary key etc) matches with the parent data table</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">Then update or delete query</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">Else</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>Insert query&#8212;&#8211;</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Here the data is processed every time it performs the insert update or delete separately.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Now using Merge how it works-&gt;</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">This feature allows you to merge two tables together based on a set of criteria. Two tables does not mean that you cannot perform joins, this I will discuss later.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Simple MERGE works on stating a table where all the data should be merged into, the table, query, and the data is coming from and the criteria to decide if they match. Based on this , the query performs on each actions like insert, update, or delete.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">MERGE tableName1 AS TARGET</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">USING(SELECT [COLUMNS] FROM tableName2 ) AS SOURCE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">ON TARGET.CRITERIA = SOURCE.CRITERIA</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN MATCHED THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>UPDATE SET</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>/* UPDATE COLUMNS*/</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN MATCHED AND [SOME CONDITION] THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>DELETE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN NOT MATCHED BY TARGET THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>INSERT (COLUMNS)</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>VALUES (SOURCE. [COLUMNS]);</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small; font-family: Calibri;"> </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Terminator (semi colon is required at the end) is mandatory after MERGE statement.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Firstly all the match clauses should be mentioned along with conditions then not match clause should be used to achieve better performance.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">This is very useful when we are inserting updating bulk data.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Now coming to some typical queries, like can we use joins with MERGE, YES we can use if we didn’t get the direct set criteria we can use joins with SOURE table.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">MERGE tableName1 as TARGET</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">USING( SELECT * FROM tableName2 inner join table3 on tableName2.criteria = table3.criteria) AS SOURCE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">ON TARGET.CRITERIA = SOURCE.CRITERIA</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN MATCHED THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>UPDATE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN MATCHED AND CONDITION* THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>DELETE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN NOT MATCHED THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>INSERT;</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Similarly we can use any number of joins according to our requirements. </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">In merge like before versions of SQL we can fetch the inserted.ids, updated.ids and deleted.ids and save into some table variable.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">Before semicolon we have to take the output into some table variables that can be used further inside the store procedure. </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">MERGE tableName1 AS TARGET</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">USING (SELECT [COLUMNS] FROM tableName2 ) AS SOURCE</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">ON TARGET.CRITERIA = SOURCE.CRITERIA</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">WHEN NOT MATCHED BY TARGET THEN</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>INSERT (COLUMNS)</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;"><span style="mso-tab-count: 1;"> </span>VALUES (SOURCE. [COLUMNS])</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">Output inserted.ids ,inserted.[columns] into<span style="mso-spacerun: yes;"> </span>@decaretable ;</span></span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">For bulk insertion, deletion, and updates we can use user typed table as parameters to the store procedure to be used as SOURCE to perform the task.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: small; font-family: Calibri;">More complex and tedious actions can be performed with ease using MERGE statement. MERGE statement is very handy improvement for T-SQL developers who have to update database tables with complicated logic. MERGE statement also improves the performance of database as it passes through data just once.</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small; font-family: Calibri;"> </span></span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in;"><span style="color: #4f81bd; mso-themecolor: accent1;"><span style="font-size: small;"><span style="font-family: Calibri;">*Any suggestions and questions are appreciated.</span></span></span></p>
<p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 1pt 0.5in;"><span style="font-size: small; font-family: Calibri;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2009/01/19/sandeverma/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Be a Miser&#8230;&#8230;&#8230;.</title>
		<link>http://blogs.circlesource.com/2008/07/30/be-a-miser/</link>
		<comments>http://blogs.circlesource.com/2008/07/30/be-a-miser/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 12:52:32 +0000</pubDate>
		<dc:creator>sandeverma</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=15</guid>
		<description><![CDATA[If a loaf can full your appetite then why to order for two loafs and waste the other one. But to this people call them stereotype of miser that is wealthy and greedy, a man who lives intelligently in order to save and increase his treasure. Same thing I have seen while creating a table [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="normal;"><span>If a loaf can full your appetite then why to order for two loafs and waste the other one. But to this people call them stereotype of miser that is wealthy and greedy, a man who lives intelligently in order to save and increase his treasure. Same thing I have seen while creating a table and columns and assigning the data-types and their sizes, if we can full fill the requirement of the data by providing the accurate or approximate size then it will not only increase the treasure(or in technical terms we used to call performance) but also we can reduce the risk which prevails in any application. If we can use tiny int and get our work done then why to use small int or simple int and burden the database and decrease the performance. Use the best data-type matching your requirement, if it is varchar don&#8217;t just define varchar, but if you know the size define it like varchar(20) or something else. Below are few data-types and the values they accommodate. I know this is the basic of but sometimes these basic things make a major difference. So when ever creating the tables <strong>BE MISER&#8230;</strong> and don&#8217;t <strong>BE SPENDTHRIFT</strong></span></p>
<table class="MsoNormalTable" style="592.5pt;" border="0" cellspacing="0" cellpadding="0" width="790">
<tbody>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><span> </span></p>
<p class="MsoNormal" style="normal;"><strong><span>bigint</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Integer data from -2^63 through   2^63-1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>int</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Integer data from -2^31 through   2^31 &#8211; 1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>smallint</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Integer data from -2^15 through   2^15 &#8211; 1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>tinyint</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Integer data from 0 through 255</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>bit</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Integer data with either a 1 or 0   value</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>decimal</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Fixed precision and scale numeric   data from -10^38 +1 through 10^38 -1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>numeric</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Fixed precision and scale numeric   data from -10^38 +1 through 10^38 -1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>money</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Monetary data values from -2^63   through 2^63 &#8211; 1</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>smallmoney</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Monetary data values from   -214,748.3648 through +214,748.3647</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>float</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Floating precision number data   from -1.79E + 308 through 1.79E + 308</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>real</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Floating precision number data   from -3.40E + 38 through 3.40E + 38</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>datetime</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Date and time data from January 1,   1753, through December 31, 9999,with an accuracy of 3.33 milliseconds</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>smalldatetime</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Date and time data from January 1,   1900, through June 6, 2079,with an accuracy of one minute</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>char</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Fixed-length character data with a   maximum length of 8,000 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>varchar</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length data with a   maximum of 8,000 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>text</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length data with a   maximum length of 2^31 &#8211; 1 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>nchar</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Fixed-length Unicode data with a   maximum length of 4,000 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>nvarchar</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length Unicode data with   a maximum length of 4,000 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>ntext</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length Unicode data with   a maximum length of 2^30 &#8211; 1 characters</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>binary</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Fixed-length binary data with a   maximum length of 8,000 bytes</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>varbinary</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length binary data with a   maximum length of 8,000 bytes</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>image</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>Variable-length binary data with a   maximum length of 2^31 &#8211; 1 bytes</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>timestamp</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>A database-wide unique number that   gets updated every time a row gets updated</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>uniqueidentifier</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>A globally unique identifier</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>sql_variant</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span>A data type that stores values of   various data types,except text, ntext, timestamp, and sql_variant</span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> varchar(max)</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> Maximum 1,073,741,824 characters </span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> text </span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> Maximum 2GB of text data </span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> nvarchar(max) </span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> Maximum 536,870,912 characters </span></strong></p>
</td>
</tr>
<tr>
<td style="82.7pt;" width="110" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> ntext</span></strong></p>
</td>
<td style="509.8pt;" width="680" valign="bottom">
<p class="MsoNormal" style="normal;"><strong><span> Unicode data. Maximum 2GB of text data</span></strong></p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2008/07/30/be-a-miser/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
