<?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>MS SQL Whatever</title>
	<atom:link href="http://sqlinfo.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlinfo.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 03 Sep 2008 14:00:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sqlinfo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>MS SQL Whatever</title>
		<link>http://sqlinfo.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sqlinfo.wordpress.com/osd.xml" title="MS SQL Whatever" />
	<atom:link rel='hub' href='http://sqlinfo.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Conditional Where Clause</title>
		<link>http://sqlinfo.wordpress.com/2008/09/03/conditional-where-clause/</link>
		<comments>http://sqlinfo.wordpress.com/2008/09/03/conditional-where-clause/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 13:58:47 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=16</guid>
		<description><![CDATA[I didn’t write any post on my blog for quite long time. Today, I spend some times to write a post. Actually, this topic is saved in my draft for quite long also. And I received one topic from SQL Server Central which is same as my topic. We know last time that we cannot [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=16&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I didn’t write any post on my blog for quite long time. Today, I spend some times to write a post. Actually, this topic is saved in my draft for quite long also. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And I received one topic from <a href="http://www.sqlservercentral.com" target="_blank">SQL Server Central</a> which is same as my topic. We know last time that we cannot put conditional filter in where clause of T-SQL statements. But that’s not true that I find out one thing which can use conditional filter in where clause.</p>
<p>I&#8217;m having a request from my customer to generate dates which are based on their shifts, 135 and 246. To get all dates in a month is not difficult which I already posted in Get All Dates section. So I&#8217;m spending some times to get that conditional where clause as follow:</p>
<p>DECLARE @Days AS varchar(3)<br />
SET @Days=&#8217;135&#8242;</p>
<p>SELECT Days FROM GetAllDates<br />
WHERE datename(dw, Days) IN (CASE WHEN SUBSTRING(@Days, 1, 1)=&#8217;1&#8242; THEN &#8216;Monday&#8217;<br />
WHEN SUBSTRING(@Days, 1, 1)=&#8217;2&#8242; THEN &#8216;Tuesday&#8217; END,<br />
CASE WHEN SUBSTRING(@Days, 2, 1) = &#8217;3&#8242; THEN &#8216;Wednesday&#8217;<br />
WHEN SUBSTRING(@Days, 2, 1) = &#8217;4&#8242; THEN &#8216;Thursday&#8217; END,<br />
CASE WHEN SUBSTRING(@Days, 3, 1) = &#8217;5&#8242; THEN &#8216;Friday&#8217;<br />
WHEN SUBSTRING(@Days, 3, 1) = &#8217;6&#8242; THEN &#8216;Saturday&#8217; END)</p>
<p>The following is some another example of conditional where clause from <a href="http://www.sqlservercentral.com/articles/T-SQL/61918/" target="_blank">SQL Server Central</a>.</p>
<p>SELECT *<br />
FROM Production.Product<br />
WHERE<br />
ProductNumber LIKE CASE<br />
WHEN @ProductNumber IS NULL THEN &#8216;%&#8217;<br />
ELSE @ProductNumber END<br />
AND Color LIKE CASE<br />
WHEN @Color IS NULL THEN &#8216;%&#8217;<br />
ELSE @Color END</p>
<p>SELECT *<br />
FROM Production.Product<br />
WHERE ReorderPoint =<br />
CASE<br />
WHEN @ReorderPoint IS NULL THEN ReorderPoint<br />
ELSE @ReorderPoint<br />
END</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=16&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/09/03/conditional-where-clause/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Constant Column and Stock or Service Discount Setup</title>
		<link>http://sqlinfo.wordpress.com/2008/06/14/constant-column-and-stock-or-service-discount-setup/</link>
		<comments>http://sqlinfo.wordpress.com/2008/06/14/constant-column-and-stock-or-service-discount-setup/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 07:01:50 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=15</guid>
		<description><![CDATA[I didn’t update my blog for quite long time. Today, let me share some knowledge on T-SQL Programming. Last time, I posted constant table. This time, I wanna post constant fields and joining 2 tables without having any relationship.  Interesting, right? Sometimes, our customer request to generate setup data for their promotion and discount. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=15&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I didn’t update my blog for quite long time. Today, let me share some knowledge on T-SQL Programming. Last time, I posted constant table. This time, I wanna post constant fields and joining 2 tables without having any relationship.  Interesting, right? Sometimes, our customer request to generate setup data for their promotion and discount. And that time, both their services or stocks table and promotion or discount table have no relationship between them. So how we generate those data as customer requested? Let us assume stock table, STOCK, has the following format:</p>
<p>StockCode | Description | Price<br />
A001         | Book         | 10<br />
A002         | Pen           |  5<br />
A003         | Pencil        |  3</p>
<p>And the discount table, DISCOUNT, has the following format:</p>
<p>DiscountCode | DiscountPercentage<br />
D010            | 10<br />
D020            | 20<br />
D025            | 25</p>
<p>Customer wants the following data:</p>
<p>StockCode | Price | DiscountCode | Percentage<br />
A001         |    10 | D010            | 10<br />
A001         |    10 | D020            | 20<br />
A001         |    10 | D025            | 25<br />
A002         |      5 | D010            | 10<br />
A002         |      5 | D020            | 20<br />
A002         |      5 | D025            | 25<br />
A003         |      3 | D010            | 10<br />
A004         |      3 | D020            | 20<br />
A005         |      3 | D025            | 25</p>
<p>Do you notice that the data is duplicating based on DiscountCode and StockCode? Where we seen this kind of duplication? We always facing duplicate error when we join two tables wrongly, right? So now you’ll get some idea how to generate that customer request. If you still have no idea how to generate, see the following how to get those data. </p>
<p>At first I add constant column in each tables in query as follow:</p>
<p>SELECT JoinSr = 1, StockCode, Price FROM STOCK</p>
<p>SELECT JoinSr = 1, DiscountCode, Percentage = DiscountPercentage FROM DISCOUNT</p>
<p>Do you notice the column name JoinSr? That’s the constant field which will show you always one in the query result. After doing this, I’ll use our normal join statement to get the require result as follow:</p>
<p>SELECT S.StockCode, S.Price, D.DiscountCode, D.Percentage FROM<br />
(SELECT JoinSr = 1, StockCode, Price FROM STOCK) S<br />
JOIN<br />
(SELECT JoinSr = 1, DiscountCode, Percentage = DiscountPercentage FROM DISCOUNT) D<br />
ON S.JoinSr = D.JoinSr</p>
<p>Now do you notice that the error we ever facing when we join two tables is helping us to get those stock discount mapping setup. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=15&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/06/14/constant-column-and-stock-or-service-discount-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Formatting Characters In SQL</title>
		<link>http://sqlinfo.wordpress.com/2008/05/01/formatting-characters-in-sql/</link>
		<comments>http://sqlinfo.wordpress.com/2008/05/01/formatting-characters-in-sql/#comments</comments>
		<pubDate>Thu, 01 May 2008 14:58:36 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Formatting Characters In SQL]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=14</guid>
		<description><![CDATA[If you want to format result values in SQL, you can use the following methods: Let assume we have integer value variable. DECLARE @DataValue AS int SET @DataValue = 2 and wanna format as &#8217;00002&#8242; There&#8217;re 2 ways to format: SELECT REPLICATE(&#8217;0&#8242;, 5 &#8211; LEN(@DataValue)) + CAST(@DataValue AS VARCHAR(MAX)) OR SELECT RIGHT(&#8217;00000&#8242; + CAST(@DataValue AS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=14&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to format result values in SQL, you can use the following methods:</p>
<p>Let assume we have integer value variable.</p>
<p>DECLARE @DataValue AS int<br />
SET @DataValue = 2</p>
<p>and wanna format as &#8217;00002&#8242;</p>
<p>There&#8217;re 2 ways to format:</p>
<p>SELECT REPLICATE(&#8217;0&#8242;, 5 &#8211; LEN(@DataValue)) + CAST(@DataValue AS VARCHAR(MAX))</p>
<p>OR</p>
<p>SELECT RIGHT(&#8217;00000&#8242; + CAST(@DataValue AS VARCHAR(max)), 5)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=14&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/05/01/formatting-characters-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Row Data to Column Data</title>
		<link>http://sqlinfo.wordpress.com/2008/05/01/row-data-to-column-data/</link>
		<comments>http://sqlinfo.wordpress.com/2008/05/01/row-data-to-column-data/#comments</comments>
		<pubDate>Thu, 01 May 2008 05:58:25 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Row Data to Column Data]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=13</guid>
		<description><![CDATA[This is also one of my question in Experts-Exchange forum. I wanna display row data to in a columnar format. I’ve one tables which include three columns such as Sr, StartDate and EndDate. I wanna display count of Sr group by month depending on the StartDate and the resulted format is as follow: Sr&#124;Jan&#124;Feb&#124;Mar&#124;..to..&#124;Dec The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=13&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is also one of my question in Experts-Exchange forum. I wanna display row data to in a columnar format. I’ve one tables which include three columns such as Sr, StartDate and EndDate. I wanna display count of Sr group by month depending on the StartDate and the resulted format is as follow:</p>
<p>Sr|Jan|Feb|Mar|..to..|Dec</p>
<p>The solution for this problem is as follow:</p>
<p>SELECT Sr, Jan = SUM(CASE WHEN MONTH(StartDate)=1 THEN 1 ELSE 0 END),<br />
Feb = SUM(CASE WHEN MONTH(StartDate)=2 THEN 1 ELSE 0 END),<br />
..<br />
FROM Table<br />
GROUP BY Sr</p>
<p>Really thanks for expert StephenCairns from <a href="http://www.experts-exchange.com">Experts-Exchange</a> for his solution which also opened my eyes on creating SQL queries later.</p>
<p>I also contributed some in experts exchange but my contributions are not very much so I won&#8217;t post my contributions in my blog. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=13&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/05/01/row-data-to-column-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Display Different Values In Respective Columns</title>
		<link>http://sqlinfo.wordpress.com/2008/05/01/display-different-values-in-respective-columns/</link>
		<comments>http://sqlinfo.wordpress.com/2008/05/01/display-different-values-in-respective-columns/#comments</comments>
		<pubDate>Thu, 01 May 2008 05:44:05 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Display Different Values In Respective Columns]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=12</guid>
		<description><![CDATA[I haven’t updated my blog for quite long time. But today I’ve times to post some information related to the SQL query. When I prepare reports for one of the hospital in Myanmar, I’m facing some difficulties to display data and raised question in Experts-Exchange. This post is my re-collection of solutions from Experts-Exchange. And [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=12&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I haven’t updated my blog for quite long time. But today I’ve times to post some information related to the SQL query. When I prepare reports for one of the hospital in Myanmar, I’m facing some difficulties to display data and raised question in Experts-Exchange. This post is my re-collection of solutions from Experts-Exchange. And also thanks for the expert, angellll, who answer this solution for me. The problem is as follow:</p>
<p>I&#8217;ve one query which join 3 tables and produce different values in 2 columns.<br />
Table A Contain (ID,SubID)<br />
Data for Table A as example:<br />
ID,     SubID<br />
1,      1<br />
2,      7</p>
<p>Table B Contain (ID, Values)<br />
Data for Table B as example:<br />
ID,     Values<br />
1,      1000<br />
2,      2500</p>
<p>Table C Contain (ID, SubID, Values)<br />
Data for Table C as example:<br />
ID,     SubID,     Values<br />
1,      1,            100<br />
1,      2,            150<br />
1,      3,            20<br />
2,      5,            0<br />
2,      7,            150</p>
<p>I want to display as follow<br />
ID,     SubID,      ID Values,      SubID Values<br />
1,      1,             1000,            100<br />
1,      2,             0,                 150<br />
1,      3,             0,                 20<br />
2,      5,             0,                 0<br />
2,      7,             2500,            150</p>
<p>The solution for this problem is as follow:<br />
SELECT a.id, a.subid, COALESCE(b.values,0) as [id values]<br />
FROM tableA a<br />
JOIN tableB b<br />
     ON a.ID = b.ID<br />
RIGHT JOIN tableC c<br />
     ON c.id = a.id<br />
AND c.subid = a.subid</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=12&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/05/01/display-different-values-in-respective-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Joining to the Next Sequential Row</title>
		<link>http://sqlinfo.wordpress.com/2008/04/11/joining-to-the-next-sequential-row/</link>
		<comments>http://sqlinfo.wordpress.com/2008/04/11/joining-to-the-next-sequential-row/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 13:57:26 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/?p=11</guid>
		<description><![CDATA[I saw this article from SQL Server Central web site and wanna make a note for myself too. So I updated this post for myself and also share to my friends. The problem is as follow: We have the following table call tbStat id stat period 1 10 1/1/2008 2 25 2/1/2008 3 5 3/1/2008 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=11&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I saw this article from SQL Server Central web site and wanna make a note for myself too. So I updated this post for myself and also share to my friends. The problem is as follow:</p>
<p>We have the following table call tbStat</p>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<td>id</td>
<td>stat</td>
<td>period</td>
</tr>
<tr>
<td>1</td>
<td>10</td>
<td>1/1/2008</td>
</tr>
<tr>
<td>2</td>
<td>25</td>
<td>2/1/2008</td>
</tr>
<tr>
<td>3</td>
<td>5</td>
<td>3/1/2008</td>
</tr>
<tr>
<td>4</td>
<td>15</td>
<td>4/1/2008</td>
</tr>
<tr>
<td>5</td>
<td>30</td>
<td>5/1/2008</td>
</tr>
<tr>
<td>6</td>
<td>9</td>
<td>6/1/2008</td>
</tr>
<tr>
<td>7</td>
<td>22</td>
<td>7/1/2008</td>
</tr>
<tr>
<td>8</td>
<td>29</td>
<td>8/1/2008</td>
</tr>
</table>
<p>And we wanna see the result as follow:</p>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<td>xID</td>
<td>yID</td>
<td>xStat</td>
<td>yStat</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>10</td>
<td>25</td>
</tr>
<tr>
<td>2</td>
<td>3</td>
<td>25</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
<td>5</td>
<td>15</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>15</td>
<td>30</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
<td>30</td>
<td>9</td>
</tr>
<tr>
<td>6</td>
<td>7</td>
<td>9</td>
<td>22</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>22</td>
<td>29</td>
</tr>
<td>8</td>
<td>null</td>
<td>29</td>
<td>null</td>
</tr>
</table>
<p>The result query string is as follow:</p>
<p>SELECT xID = x.id, yID = y.id, xStat = x.stat, yStat = y.stat FROM<br />
tbStat x LEFT JOIN tbStat y ON x.id + 1 = y.id<br />
ORDER BY x.id</p>
<p>This article can implement in moving average calculation. You can see the full article <a href="http://www.sqlteam.com/article/joining-to-the-next-sequential-row" target="_blank"> here</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=11&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/04/11/joining-to-the-next-sequential-row/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Get All Dates</title>
		<link>http://sqlinfo.wordpress.com/2008/03/29/get-all-dates/</link>
		<comments>http://sqlinfo.wordpress.com/2008/03/29/get-all-dates/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 09:28:59 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Get All Dates]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/2008/03/29/get-all-dates/</guid>
		<description><![CDATA[When we develop application, we need all the days from the month sometimes. We are thinking of the way to create StoreProcedure to generate days using temp table and cursor. But using cursor will slow down our application process and we want faster way to get all days. So we think of another way to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=10&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we develop application, we need all the days from the month sometimes. We are thinking of the way to create StoreProcedure to generate days using temp table and cursor. But using cursor will slow down our application process and we want faster way to get all days. So we think of another way to create one table which store all the days from 1-Jan of current year to 31-Dec. That’s also not easy to maintain this table and need to insert all days every year. Actually, I’m using this method in one of my application. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Don’t try to use this method. This is very risky to get all days and insert all days. Here is very useful query statement to generate days from the month or the given months. I got this statement from one SQL forum but I forgot from which forum and who posted it. Anyway, this statement is really helpful to me and I’m sure you’ll also. Here’s the statement:</p>
<p>DECLARE @FirstDay smalldatetime, @NumberOfMonths int<br />
SELECT @FirstDay = &#8217;20080301&#8242;, @NumberOfMonths = 1<br />
;WITH Days AS (<br />
SELECT @FirstDay as CalendarDay<br />
UNION ALL<br />
SELECT DATEADD(d, 1, CalendarDay) as CalendarDay<br />
FROM Days<br />
WHERE DATEADD(d, 1, CalendarDay) &lt; DATEADD(m, @NumberOfMonths, @FirstDay)<br />
)<br />
SELECT CalendarDay FROM Days</p>
<p>If you set 2 to @NumberOfMonths variable, you’ll get all the days from 2 months such as Mar and Apr.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=10&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/03/29/get-all-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Constant Table</title>
		<link>http://sqlinfo.wordpress.com/2008/03/29/constant-table/</link>
		<comments>http://sqlinfo.wordpress.com/2008/03/29/constant-table/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 04:16:59 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Constant Table]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/2008/03/29/constant-table/</guid>
		<description><![CDATA[In database development, sometimes we really need to display some constant data and don’t wanna let user change that constant data. But those data are not so many and don’t wanna create table. For this situation, we’ve one alternative way in SQL to create constant table. The trick is not so advanced but it’s really [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=7&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In database development, sometimes we really need to display some constant data and don’t wanna let user change that constant data. But those data are not so many and don’t wanna create table. For this situation, we’ve one alternative way in SQL to create constant table. The trick is not so advanced but it’s really easy and we already know those statements. We just create one simple view using the following statements:</p>
<p>SELECT CustomerTypeID  = 1, CustomerType = ‘Ordinary’<br />
UNION ALL<br />
SELECT CustomerTypeID  = 2, CustomerType = ‘Executive’<br />
UINON ALL<br />
SELECT CustomerTypeID  = 3, CustomerType = ‘Ultimate’</p>
<p>The above statement will give you one constant table for customer type. If you’ve more type, just edit the view and append another types. You can apply this in All SQL Version. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=7&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/03/29/constant-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>Add Serial Number to Our Query Result</title>
		<link>http://sqlinfo.wordpress.com/2008/03/29/add-serial-number-to-our-query-result/</link>
		<comments>http://sqlinfo.wordpress.com/2008/03/29/add-serial-number-to-our-query-result/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 04:16:36 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Add Serial Number to Our Query Result]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/2008/03/29/add-serial-number-to-our-query-result/</guid>
		<description><![CDATA[Sometimes, we need to add serial number in our query result to show on the report. I’m not sure SQL 2000 has this feature or not but I never use that feature in SQL 2000. In SQL 2005, we’ve one function call ROW_NUMBER(). So we can display serial number in our query result. The example [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=6&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes, we need to add serial number in our query result to show on the report. I’m not sure SQL 2000 has this feature or not but I never use that feature in SQL 2000. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  In SQL 2005, we’ve one function call ROW_NUMBER(). So we can display serial number in our query result. The example for that function is as follow:</p>
<p>SELECT ROW_NUMBER() OVER(ORDER BY customername) FROM customer WHERE customername LIKE ‘John%’</p>
<p>You can see detail description of this function at <a href="http://msdn2.microsoft.com/en-us/library/ms186734.aspx" target="_blank">Microsoft MSDN Online</a>.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=6&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/03/29/add-serial-number-to-our-query-result/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
		<item>
		<title>What Are The Backgroud Files of Your Database?</title>
		<link>http://sqlinfo.wordpress.com/2008/03/29/what-are-the-backgroud-files-of-your-database/</link>
		<comments>http://sqlinfo.wordpress.com/2008/03/29/what-are-the-backgroud-files-of-your-database/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 04:16:10 +0000</pubDate>
		<dc:creator>TNT @ Albert Sun</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[What Are The Backgroud Files of Your Database?]]></category>

		<guid isPermaLink="false">http://sqlinfo.wordpress.com/2008/03/29/what-are-the-backgroud-files-of-your-database/</guid>
		<description><![CDATA[If you are boring on reading long text in my previous post, here’s some little text for you. Do you know how many data file type created from SQL 2005 after you created your database? You didn’t notice or forgot, right? If you didn’t create partition(s), there’re two files created which are .MDF file and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=5&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are boring on reading long text in my previous post, here’s some little text for you. Do you know how many data file type created from SQL 2005 after you created your database? You didn’t notice or forgot, right? If you didn’t create partition(s), there’re two files created which are .MDF file and .LDF file. .MDF for your primary data file and .LDF for your log file. If you created partition(s), you&#8217;ll see .NDF file as secondary data file(s). In one database, there’s only one primary data file.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sqlinfo.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sqlinfo.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlinfo.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlinfo.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlinfo.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqlinfo.wordpress.com&amp;blog=3310202&amp;post=5&amp;subd=sqlinfo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqlinfo.wordpress.com/2008/03/29/what-are-the-backgroud-files-of-your-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f8bd37fd37e42c142947087ae4b7a765?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">TNT @ Albert Sun</media:title>
		</media:content>
	</item>
	</channel>
</rss>
