<?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>ProgrammingOcean</title>
	<atom:link href="http://programmingocean.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingocean.wordpress.com</link>
	<description>Sharing Knowledge with IT Professionals</description>
	<lastBuildDate>Tue, 09 Mar 2010 02:17:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='programmingocean.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ProgrammingOcean</title>
		<link>http://programmingocean.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://programmingocean.wordpress.com/osd.xml" title="ProgrammingOcean" />
	<atom:link rel='hub' href='http://programmingocean.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Get the Column data in a single row with comma separator in SQL</title>
		<link>http://programmingocean.wordpress.com/2010/03/09/get-the-column-data-in-a-single-row-with-comma-separator-in-sql/</link>
		<comments>http://programmingocean.wordpress.com/2010/03/09/get-the-column-data-in-a-single-row-with-comma-separator-in-sql/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 02:17:44 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=154</guid>
		<description><![CDATA[In this post i thought to expalin how to get one column data in a single row with comma separator. as i shown shown below a table have one column call Choice which have 4 rows. So our task is how to bring up all these 4 rows into one single row with comma separator. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=154&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post i thought to expalin how to get one column data in a single row with comma separator. as i shown shown below a table have one column call Choice which have 4 rows.</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/03/before_coalesce_function1.jpg"><img class="aligncenter size-full wp-image-155" title="Before_COALESCE_Function1" src="http://programmingocean.files.wordpress.com/2010/03/before_coalesce_function1.jpg?w=500" alt=""   /></a></p>
<p>So our task is how to bring up all these 4 rows into one single row with comma separator.<br />
We can do this in 2 methods,</p>
<ol>
<li><span style="color:#0000ff;">Using COALESCE() function</span></li>
<li><span style="color:#0000ff;">Using ISNULL() Function</span></li>
</ol>
<p>Actually both are playing same role.</p>
<p><strong>1. Using COALESCE() function</strong></p>
<p>As shown below in the SQL Query below, COALESCE() function takes 2 parameters.<br />
It is check whether passed field value is Null or not if it is null then place with blank whereas if the field value is not null then concatenate value with comma.</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1.jpg"><img class="aligncenter size-full wp-image-156" title="COALESCE_Function1" src="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1.jpg?w=500&#038;h=446" alt="" width="500" height="446" /></a></p>
<p><strong>2. Using ISNULL() Function</strong></p>
<p>This query also working similar to COALESCE() function.</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/03/isnull_function11.jpg"><img class="aligncenter size-full wp-image-159" title="ISNULL_Function1" src="http://programmingocean.files.wordpress.com/2010/03/isnull_function11.jpg?w=500&#038;h=465" alt="" width="500" height="465" /></a></p>
<p>here  value &#8216;A&#8217; repeating twice. so how to get distinct value from this?<br />
here it is the SQL query for that,</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1_distinct.jpg"><img class="aligncenter size-full wp-image-158" title="COALESCE_Function1_Distinct" src="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1_distinct.jpg?w=500" alt=""   /></a></p>
<p>We just write subquery to filter only distinct values and using that as a Table for Outer query.<br />
So here only gives A,B,C.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=154&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/03/09/get-the-column-data-in-a-single-row-with-comma-separator-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/03/before_coalesce_function1.jpg" medium="image">
			<media:title type="html">Before_COALESCE_Function1</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1.jpg" medium="image">
			<media:title type="html">COALESCE_Function1</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/03/isnull_function11.jpg" medium="image">
			<media:title type="html">ISNULL_Function1</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/03/coalesce_function1_distinct.jpg" medium="image">
			<media:title type="html">COALESCE_Function1_Distinct</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get the month name in SQL Server</title>
		<link>http://programmingocean.wordpress.com/2010/03/09/how-to-get-the-month-name-in-sql-server/</link>
		<comments>http://programmingocean.wordpress.com/2010/03/09/how-to-get-the-month-name-in-sql-server/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 02:01:16 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=150</guid>
		<description><![CDATA[There is a built-in function called datename() for find the month name from given date. for example: SELECT DATENAME(mm,'03/03/2010')<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=150&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is a built-in function called datename() for find the month name from given date.<br />
for example:</p>
<h2><code>SELECT DATENAME(mm,'03/03/2010')</code></h2>
<p><a href="http://programmingocean.files.wordpress.com/2010/03/getname.jpg"><img class="aligncenter size-full wp-image-149" title="GetName" src="http://programmingocean.files.wordpress.com/2010/03/getname.jpg?w=500" alt=""   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=150&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/03/09/how-to-get-the-month-name-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/03/getname.jpg" medium="image">
			<media:title type="html">GetName</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get SQL Server Name in SQL Server</title>
		<link>http://programmingocean.wordpress.com/2010/02/26/how-to-get-sql-server-name-in-sql-server/</link>
		<comments>http://programmingocean.wordpress.com/2010/02/26/how-to-get-sql-server-name-in-sql-server/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 09:17:44 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Server Name]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=138</guid>
		<description><![CDATA[We can get the Connected Sql Server Name using the Built-in function SQL Server as shown below,<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=138&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We can get the Connected Sql Server Name using the Built-in function SQL Server as shown below,</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/02/server_name.jpg"><img class="aligncenter size-full wp-image-137" title="Server_name" src="http://programmingocean.files.wordpress.com/2010/02/server_name.jpg?w=500" alt=""   /></a><a href="http://programmingocean.files.wordpress.com/2010/02/server_name_output.jpg"><img class="aligncenter size-full wp-image-139" title="Server_Name_Output" src="http://programmingocean.files.wordpress.com/2010/02/server_name_output.jpg?w=500" alt=""   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=138&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/02/26/how-to-get-sql-server-name-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/02/server_name.jpg" medium="image">
			<media:title type="html">Server_name</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/02/server_name_output.jpg" medium="image">
			<media:title type="html">Server_Name_Output</media:title>
		</media:content>
	</item>
		<item>
		<title>Extract only Date from DATETIME in Sql Server</title>
		<link>http://programmingocean.wordpress.com/2010/02/26/118/</link>
		<comments>http://programmingocean.wordpress.com/2010/02/26/118/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 08:30:03 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Extract Date from DateTime]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=118</guid>
		<description><![CDATA[Normaly extracting date only from DATETIME is common and serious problem in SQL SERVER. Here i have given some common methods to extract on the date from datetime Method 1 &#8212;&#8212;&#8212;&#8212; SELECT CAST ( FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME ) Method 2&#8211;but it is not correct &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; This is similar to first method but we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=118&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Normaly extracting date only from DATETIME is common and serious problem in SQL SERVER.<br />
Here i have given some common methods to extract on the date from datetime</p>
<p>Method 1</p>
<p>&#8212;&#8212;&#8212;&#8212;<br />
<strong><br />
SELECT<br />
CAST<br />
(<br />
FLOOR(CAST(GETDATE() AS FLOAT))<br />
AS DATETIME<br />
)<br />
</strong><br />
Method 2&#8211;but it is not correct</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
This is similar to first method but we have used INT instead of FLOAT . But it will seldom correct. It will not give you the exact date of what you expecting.<br />
So better not to use INT.</p>
<p><strong><br />
SELECT<br />
CAST<br />
(<br />
FLOOR(CAST(GETDATE() AS INT))<br />
AS DATETIME<br />
)<br />
</strong><br />
Method 3</p>
<p>&#8212;&#8212;&#8212;-<br />
i would recommend this method to extract inly date though there are many methods. because this method is very simple and easy.</p>
<p><strong><br />
SELECT<br />
CAST<br />
(<br />
STR(DAY(GETDATE()))+ &#8216;/&#8217; +<br />
STR(MONTH(GETDATE())) +&#8217;/'+<br />
STR(YEAR(GETDATE()))<br />
AS DATETIME<br />
)<br />
</strong><br />
Method 4</p>
<p>&#8212;&#8212;&#8212;-<br />
In this we have used CONVERT function with 113 date type.<br />
<strong><br />
SELECT CONVERT(DATETIME, CONVERT(VARCHAR(12), GETDATE(), 113))<br />
</strong><br />
Method 5</p>
<p>&#8212;&#8212;&#8212;-<br />
Here we have used DATEDIFF and DATEADD functions together to extract.get the different between specified date and 0 then again add o with output value of DATEDIFF<br />
<strong><br />
SELECT DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)<br />
</strong></p>
<p>Method 6</p>
<p>&#8212;&#8212;&#8212;-<br />
This is also similar to previous method. But here we have not used DATEADD instead we have used CAST.<br />
<strong><br />
SELECTCAST(DATEDIFF(dd,0,GETDATE() as datetime)<br />
</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=118&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/02/26/118/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>
	</item>
		<item>
		<title>How to insert multiple rows records using a single Insert Into SQL Command</title>
		<link>http://programmingocean.wordpress.com/2010/02/10/how-to-insert-multiple-rows-records-using-a-single-insert-into-sql-command/</link>
		<comments>http://programmingocean.wordpress.com/2010/02/10/how-to-insert-multiple-rows-records-using-a-single-insert-into-sql-command/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 08:55:36 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=111</guid>
		<description><![CDATA[if we want to insert multiple rows records, we can still use insert into command for each row as shown below, but you can insert all those rows by using one insert into command rather than using more insert into command as shown below,<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=111&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>if we want to insert multiple rows records, we can still use <strong>insert into</strong> command for each row as shown below,</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/02/insert-into.jpg"><img class="aligncenter size-full wp-image-112" title="Insert into" src="http://programmingocean.files.wordpress.com/2010/02/insert-into.jpg?w=500" alt=""   /></a>but you can insert all those rows by using one <strong>insert into</strong> command rather than using more <strong>insert into</strong> command as shown below,</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/02/insert-into2.jpg"><img class="aligncenter size-full wp-image-113" title="Insert into2" src="http://programmingocean.files.wordpress.com/2010/02/insert-into2.jpg?w=500" alt=""   /></a></p>
<p><img src="/DOCUME%7E1/ELLA%7E1.MUR/LOCALS%7E1/Temp/moz-screenshot.jpg" alt="" /><img src="/DOCUME%7E1/ELLA%7E1.MUR/LOCALS%7E1/Temp/moz-screenshot-1.jpg" alt="" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/111/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/111/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/111/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=111&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/02/10/how-to-insert-multiple-rows-records-using-a-single-insert-into-sql-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/02/insert-into.jpg" medium="image">
			<media:title type="html">Insert into</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/02/insert-into2.jpg" medium="image">
			<media:title type="html">Insert into2</media:title>
		</media:content>
	</item>
		<item>
		<title>How to split the two columns table records into six columns table data in SQL Server</title>
		<link>http://programmingocean.wordpress.com/2010/01/25/102/</link>
		<comments>http://programmingocean.wordpress.com/2010/01/25/102/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:13:51 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cube]]></category>
		<category><![CDATA[Rollup]]></category>
		<category><![CDATA[Running Total]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=102</guid>
		<description><![CDATA[How to split the two columns table records into six columns table data Let’s say, a table consists two columns which are name1 and email1. But need to show this table data six columns table data. E.g: name1, email1(Table1) à name1,email1, name2,email2, name3,email3( Table2) For this we will have to write a small procedure as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=102&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration:underline;">How to split the two columns table records into six columns table data</span></strong></p>
<p>Let’s say, a table consists two columns which are name1 and email1. But need to show this table data six columns table data.</p>
<p>E.g: name1, email1(Table1) à name1,email1, name2,email2, name3,email3( Table2)</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/01/split_column2.jpg"><img class="aligncenter size-full wp-image-105" title="Split_Column" src="http://programmingocean.files.wordpress.com/2010/01/split_column2.jpg?w=500" alt="" /></a></p>
<p>For this we will have to write a small procedure as hown below,</p>
<p><span style="color:#339966;">&#8211;First we created a temporary table for inserting name1 and email1 data</span></p>
<p><span style="color:#0000ff;">create table</span> #temp1 (name1  <span style="color:#0000ff;">nvarchar(50)</span>,email1   <span style="color:#0000ff;"> nvarchar(50)</span>)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Nimal&#8217;,'nimal@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Ravi&#8217;,'ravi@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Malan&#8217;,'malan@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Vimal&#8217;,'vimal@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Young&#8217;,'young@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;John&#8217;,'john@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Susmitha&#8217;,'sus@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Vaani&#8217;,'vaani@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Chris&#8217;,'chris@abc.com&#8217;)</p>
<p><span style="color:#0000ff;">insert  into</span> #temp1 <span style="color:#0000ff;">values</span>(&#8216;Ganesh&#8217;,'ganesh@abc.com&#8217;)</p>
<p><span style="color:#339966;">&#8211;Create the Temporary Table with six columns for inserting the data</span></p>
<p><span style="color:#0000ff;">create table</span> #temp (name1  n<span style="color:#0000ff;">varchar(50)</span>,email1    <span style="color:#0000ff;">nvarchar(50)</span>,name2  <span style="color:#0000ff;">nvarchar(50)</span>,email2    <span style="color:#0000ff;">nvarchar(50)</span>,name3  <span style="color:#0000ff;">nvarchar(50)</span>,email3    <span style="color:#0000ff;">nvarchar(50)</span>)</p>
<p><span style="color:#339966;">&#8211;Delete the Data from Temp table before insert</span></p>
<p><span style="color:#0000ff;">delete from</span> #temp</p>
<p><span style="color:#339966;">&#8211;Declare Local Variables for Cursor</span></p>
<p><span style="color:#0000ff;">declare</span> @name as <span style="color:#0000ff;">nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @email <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @name1 <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declar</span>e  @email1 <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @name2 <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @email2 <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @name3 as <span style="color:#0000ff;">nvarchar(50)</span></p>
<p><span style="color:#0000ff;">declare</span> @email3 <span style="color:#0000ff;">as nvarchar(50)</span></p>
<p><span style="color:#339966;">&#8211;Declare a Cursor for read the records from the Table</span></p>
<p><span style="color:#0000ff;">declare </span>cur <span style="color:#0000ff;">cursor </span><span style="color:#0000ff;">for</span></p>
<p><span style="color:#0000ff;">select </span>* <span style="color:#0000ff;">from </span>#temp1</p>
<p><span style="color:#339966;">&#8211;Open the Cursor and Fetch First record into Local variables</span></p>
<p><span style="color:#0000ff;">open</span> cur</p>
<p><span style="color:#0000ff;">fetch </span>next <span style="color:#0000ff;">from </span>cur  <span style="color:#0000ff;">into </span>@name,@email</p>
<p><span style="color:#0000ff;">while </span><span style="color:#ff00ff;">@@fetch_status</span>=0</p>
<p><span style="color:#0000ff;">begin</span></p>
<p><span style="color:#339966;">&#8211;Assign First Record</span></p>
<p><span style="color:#0000ff;">set </span>@name1=@name</p>
<p><span style="color:#0000ff;">set </span>@email1=@email</p>
<p><span style="color:#339966;">&#8211;Move to second record and Assign</span></p>
<p><span style="color:#0000ff;">fetch </span>next <span style="color:#0000ff;">from </span>cur  into @name,@email</p>
<p><span style="color:#0000ff;">if </span>(<span style="color:#ff00ff;">@@fetch_status</span>=0)</p>
<p><span style="color:#0000ff;">begin</span></p>
<p><span style="color:#0000ff;">set </span>@name2=@name</p>
<p><span style="color:#0000ff;">set </span>@email2=@email</p>
<p><span style="color:#0000ff;">end</span></p>
<p><span style="color:#0000ff;">else</span></p>
<p><span style="color:#0000ff;">begin</span></p>
<p><span style="color:#0000ff;">set </span>@name2=&#8221;</p>
<p><span style="color:#0000ff;">set </span>@email2=&#8221;</p>
<p><span style="color:#0000ff;">end</span></p>
<p><span style="color:#339966;">&#8211;Move to Third record and Assign</span></p>
<p><span style="color:#0000ff;">fetch </span>next <span style="color:#0000ff;">from </span>cur  <span style="color:#0000ff;">into </span>@name,@email</p>
<p><span style="color:#0000ff;">if </span>(<span style="color:#ff00ff;">@@fetch_status</span>=0)</p>
<p><span style="color:#0000ff;">begin</span></p>
<p><span style="color:#0000ff;">set </span>@name3=@name</p>
<p><span style="color:#0000ff;">set </span>@email3=@email</p>
<p><span style="color:#0000ff;">end</span></p>
<p><span style="color:#0000ff;">else</span></p>
<p><span style="color:#0000ff;">begin</span></p>
<p><span style="color:#0000ff;">set </span>@name3=&#8221;</p>
<p><span style="color:#0000ff;">set </span>@email3=&#8221;</p>
<p><span style="color:#0000ff;">end</span></p>
<p><span style="color:#339966;">&#8211;Insert those three records as one row in to Temp Table</span></p>
<p><span style="color:#0000ff;">insert </span><span style="color:#0000ff;">into </span>#temp(name1,email1,name2,email2,name3,email3)</p>
<p><span style="color:#0000ff;">values</span>(@name1,@email1,@name2,@email2,@name3,@email3)</p>
<p><span style="color:#339966;">&#8211;Move to Next record</span></p>
<p><span style="color:#0000ff;">fetch </span>next <span style="color:#0000ff;">from </span>cur  <span style="color:#0000ff;">into </span>@name,@email</p>
<p><span style="color:#0000ff;">end</span></p>
<p><span style="color:#339966;">&#8211;After read the records close the Cursor</span></p>
<p><span style="color:#0000ff;">close </span>cur</p>
<p><span style="color:#339966;">&#8211;Must Deallocate the Cursor for clear from  Memory</span></p>
<p><span style="color:#0000ff;">deallocate </span>cur</p>
<p><span style="color:#339966;">&#8211;Populate the Inserted Data from Temporary Table.</span></p>
<p><span style="color:#0000ff;">select </span>* <span style="color:#0000ff;">from </span>#temp</p>
<p><span style="color:#339966;">&#8211;After that Drop the Temp Table from Database</span></p>
<p><span style="color:#0000ff;">drop </span><span style="color:#0000ff;">table </span>#temp</p>
<p><span style="color:#0000ff;">drop </span><span style="color:#0000ff;">table </span>#temp1</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=102&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/01/25/102/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/01/split_column2.jpg" medium="image">
			<media:title type="html">Split_Column</media:title>
		</media:content>
	</item>
		<item>
		<title>PIVOT() Function MSSQL Server</title>
		<link>http://programmingocean.wordpress.com/2010/01/21/pivot-function-mssql-server/</link>
		<comments>http://programmingocean.wordpress.com/2010/01/21/pivot-function-mssql-server/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 09:08:17 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=94</guid>
		<description><![CDATA[Introduction The PIVOT() function in MS SQL Server is very useful function. This is works like Cross-Tab table in Crystal Report. Explanation For an instance, as shown below table, we have customer,Yr,Mothname, and TTL columns. The Year column consisting distinct records 2009,2010 year. If you want to show the Year data as each column header name, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=94&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="text-decoration:underline;">Introduction</span></strong></p>
<p>The PIVOT() function in MS SQL Server is very useful function. This is works like Cross-Tab table in Crystal Report.</p>
<p><strong><span style="text-decoration:underline;">Explanation</span></strong></p>
<p>For an instance, as shown below table, we have customer,Yr,Mothname, and TTL columns. The Year column consisting distinct records 2009,2010 year. If you want to show the Year data as each column header name, then you will have to use the <strong>PIVOT()</strong> function to show the distinct records as column header.</p>
<p><strong>SELECT</strong><strong> user_id Customer,datepart(&#8220;yyyy&#8221;,order_date) Yr,datename(month,order_date) [Month] ,</strong></p>
<p><strong> isnull(sum(total_value),0) TTL</strong></p>
<p><strong>FROM</strong><strong> tbl_po_master group by user_id,datepart(&#8220;yyyy&#8221;,order_date),datename(month,order_date)</strong></p>
<p><strong><br />
</strong></p>
<p><a href="http://programmingocean.files.wordpress.com/2010/01/group-query-result1.jpg"><img class="aligncenter size-full wp-image-95" title="Group Query Result" src="http://programmingocean.files.wordpress.com/2010/01/group-query-result1.jpg?w=500" alt="" /></a></p>
<p><strong><span style="text-decoration:underline;">Using PIVOT() function</span></strong></p>
<p>In PIVOT() function, you must specify the column values as shown below,</p>
<p><strong> </strong><strong>select</strong><strong> * from</strong></p>
<p><strong>(</strong><strong>SELECT</strong><strong> user_id Customer,datepart(&#8220;yyyy&#8221;,order_date) Yr,datename(month,order_date) [Month] ,</strong></p>
<p><strong> isnull(sum(total_value),0) TTL</strong></p>
<p><strong>FROM</strong><strong> tbl_po_master group by user_id,datepart(&#8220;yyyy&#8221;,order_date),datename(month,order_date)  ) s </strong></p>
<p><strong>PIVOT</strong><strong> </strong></p>
<p><strong>(</strong><strong> </strong></p>
<p><strong> sum(TTL)</strong></p>
<p><strong> FOR yr IN ([2009],[2010]) </strong></p>
<p><strong>)</strong><strong> p </strong></p>
<p><strong>order</strong><strong> by Customer</strong></p>
<p>With our previous query we need to use PIVOT() function and in PIVOT() function have to give the aggregating filed and give the filed/Column name which should show as each column header.</p>
<p><strong>sum</strong><strong>(</strong><strong>TTL) </strong><strong>à</strong><strong> </strong>This is the Aggregate field</p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<p><strong>FOR</strong><strong> yr IN ([2009],[2010]) </strong></p>
<p><strong> </strong></p>
<p>Here, give the column name which should show each column header. And give the distinct values of that field as parameter for <strong>IN()</strong>.</p>
<p><a href="http://programmingocean.files.wordpress.com/2010/01/query_results3.jpg"><img class="aligncenter size-full wp-image-96" title="QUERY_RESULTS" src="http://programmingocean.files.wordpress.com/2010/01/query_results3.jpg?w=500" alt="" /></a></p>
<p>After executed the above query you would get this result in which you could notice that 2009,2010 column values became as each column header</p>
<p>In this above query you can give the Month column name instead of Yr column. If try with that you would get the out put as shown below,</p>
<p><strong><span style="text-decoration:underline;">Query:</span></strong></p>
<p><strong><span style="text-decoration:underline;"> </span></strong></p>
<p><strong>select</strong><strong> * from</strong></p>
<p><strong>(</strong><strong>SELECT</strong><strong> user_id Customer,datepart(&#8220;yyyy&#8221;,order_date) Yr,datename(month,order_date) [Month] ,</strong></p>
<p><strong> isnull(sum(total_value),0) TTL</strong></p>
<p><strong>FROM</strong><strong> tbl_po_master group by user_id,datepart(&#8220;yyyy&#8221;,order_date),datename(month,order_date)  ) s </strong></p>
<p><strong>PIVOT</strong><strong> </strong></p>
<p><strong>(</strong><strong> </strong></p>
<p><strong> sum(TTL)</strong></p>
<p><strong> FOR Month IN ([December],[January]) </strong></p>
<p><strong>)</strong><strong> p </strong></p>
<p><strong>order</strong><strong> by Customer</strong></p>
<p><strong><span style="text-decoration:underline;">Output:</span></strong></p>
<p><strong><span style="text-decoration:underline;"><a href="http://programmingocean.files.wordpress.com/2010/01/query_results21.jpg"><img class="aligncenter size-full wp-image-97" title="QUERY_RESULTS2" src="http://programmingocean.files.wordpress.com/2010/01/query_results21.jpg?w=500" alt="" /></a></span></strong></p>
<p>Now in the output, Month field distinct values (December and January) are showing as column header mean while Yr column values (2009,2010) are showing as row</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=94&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2010/01/21/pivot-function-mssql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/01/group-query-result1.jpg" medium="image">
			<media:title type="html">Group Query Result</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/01/query_results3.jpg" medium="image">
			<media:title type="html">QUERY_RESULTS</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2010/01/query_results21.jpg" medium="image">
			<media:title type="html">QUERY_RESULTS2</media:title>
		</media:content>
	</item>
		<item>
		<title>Read a Text File using Java</title>
		<link>http://programmingocean.wordpress.com/2009/07/21/read-a-text-file-using-java/</link>
		<comments>http://programmingocean.wordpress.com/2009/07/21/read-a-text-file-using-java/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 06:29:06 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=76</guid>
		<description><![CDATA[If you want to read a Text file content in java, for an example, from given Text file, if you want to read this file content, first you have to import the java.io.* class for input/output operations. then create objects from these 4 classes, which are File - To access the Text file which want [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=76&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to read a Text file content in java,</p>
<p>for an example, from given Text file,</p>
<p><img class="aligncenter size-full wp-image-78" title="Text File" src="http://programmingocean.files.wordpress.com/2009/07/text1.jpg?w=500" alt="Text File"   /></p>
<p>if you want to read this file content, first you have to import the java.io.* class for input/output operations.</p>
<p>then create objects from these 4 classes, which are</p>
<ol>
<li><strong><span style="color:#993300;">File</span> </strong>- To access the Text file which want to read.</li>
<li><span style="color:#993300;"><strong>FileInputStream</strong></span> &#8211; To Read the file content.</li>
<li><span style="color:#993300;"><strong>BufferedInputStream</strong></span> &#8211; To buffer the read streams</li>
<li><span style="color:#993300;"><strong>DataInputStream</strong></span> &#8211; To read the data which are in buffer.</li>
</ol>
<p>or else you can import these class individually as shown below,</p>
<p><img class="aligncenter size-full wp-image-81" title="imports individually" src="http://programmingocean.files.wordpress.com/2009/07/imports.jpg?w=500" alt="imports individually" /></p>
<p>Here it is the source for this,</p>
<p><img class="aligncenter size-full wp-image-79" title="File_Reader Source" src="http://programmingocean.files.wordpress.com/2009/07/file_reader.jpg?w=500" alt="File_Reader Source"   /></p>
<p>output of above source,</p>
<p><img class="aligncenter size-full wp-image-80" title="Output" src="http://programmingocean.files.wordpress.com/2009/07/output.jpg?w=500" alt="Output"   />whatever in Text File it would give as result.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=76&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2009/07/21/read-a-text-file-using-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/text1.jpg" medium="image">
			<media:title type="html">Text File</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/imports.jpg" medium="image">
			<media:title type="html">imports individually</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/file_reader.jpg" medium="image">
			<media:title type="html">File_Reader Source</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/output.jpg" medium="image">
			<media:title type="html">Output</media:title>
		</media:content>
	</item>
		<item>
		<title>How to validate the user to key in only positive number</title>
		<link>http://programmingocean.wordpress.com/2009/07/20/how-to-validate-the-user-to-key-in-only-positive-number/</link>
		<comments>http://programmingocean.wordpress.com/2009/07/20/how-to-validate-the-user-to-key-in-only-positive-number/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 09:03:43 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=68</guid>
		<description><![CDATA[We can validate the user from not to key in the non-numeric and negative  where he needs to enter positive number only. first we need to check whether he keyed in  positive number then if user keyed in a non-numeric sytem would throw an exception which is NumberFormat exception. we can catch this exception and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=68&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We can validate the user from not to key in the non-numeric and negative  where he needs to enter positive number only.</p>
<p>first we need to check whether he keyed in  positive number then if user keyed in a non-numeric sytem would throw an exception which is NumberFormat exception. we can catch this exception and pop up a message to user to key in a valid number.</p>
<p>Java code for this,</p>
<p><img class="aligncenter size-full wp-image-72" title="Source" src="http://programmingocean.files.wordpress.com/2009/07/javac.jpg?w=500" alt="Source"   /></p>
<p>Output for this,</p>
<p><img class="aligncenter size-full wp-image-73" title="Output" src="http://programmingocean.files.wordpress.com/2009/07/resc.jpg?w=500" alt="Output"   /></p>
<p>When user key in &#8216;sd&#8217;, system asking him to key in the valid number though keyed in negative value system would ask him to key in again. It would repeat till he key in the positive number.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=68&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2009/07/20/how-to-validate-the-user-to-key-in-only-positive-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/javac.jpg" medium="image">
			<media:title type="html">Source</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/resc.jpg" medium="image">
			<media:title type="html">Output</media:title>
		</media:content>
	</item>
		<item>
		<title>Get the Running Total in Oracle</title>
		<link>http://programmingocean.wordpress.com/2009/07/16/get-the-running-total-in-oracle/</link>
		<comments>http://programmingocean.wordpress.com/2009/07/16/get-the-running-total-in-oracle/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 07:56:01 +0000</pubDate>
		<dc:creator>youngmurukan</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://programmingocean.wordpress.com/?p=57</guid>
		<description><![CDATA[This very frequent needful thing for developers as they need to create so many reports based on this concept. For this you will have to use one of the window functions in oracle which is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. This would add each and every vale with previous value and give like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=57&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This very frequent needful thing for developers as they need to create so many reports based on this concept.</p>
<p>For this you will have to use one of the window functions in oracle which is <strong>ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.</strong></p>
<p><strong> </strong></p>
<p>This would add each and every vale with previous value and give like Running Total.</p>
<p>Query for this,</p>
<p><span style="color:#0000ff;">SELECT </span>PRODUCT_NO,PL_NO,  UNRESTRICTED_QTY,</p>
<p>SUM(UNRESTRICTED_QTY) OVER (ORDER BY PRODUCT_NO <span style="color:#0000ff;">ROWS</span> <span style="color:#0000ff;">BETWEEN </span>UNBOUNDED PRECEDING <span style="color:#0000ff;">AND CURRENT ROW</span>) RUNNING_TOTAL</p>
<p><span style="color:#0000ff;">FROM </span>PRODUCT_LOCATION</p>
<p><span style="color:#0000ff;">WHERE </span>CLIENT_C=UPPER(&#8216;MSWG&#8217;) AND UNRESTRICTED_QTY&gt;0 <span style="color:#0000ff;">AND</span> LOCATION_NO=&#8217;<span style="color:#ff0000;">RECEIPT_BAY</span>&#8216;</p>
<p><img class="aligncenter size-full wp-image-58" title="Query" src="http://programmingocean.files.wordpress.com/2009/07/windowfn.jpg?w=500" alt="Query"   /></p>
<p>row in the result set and adding up the values with currently reading value which is specified by <strong>CURRENT</strong><strong> </strong><strong>ROW</strong> up to last record of the record set.</p>
<p>And ordering results by PRODUCT_NO</p>
<p>The result of the above query shown below.</p>
<p><img class="aligncenter size-full wp-image-59" title="Query Result" src="http://programmingocean.files.wordpress.com/2009/07/window_res.jpg?w=500" alt="Query Result"   /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/programmingocean.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/programmingocean.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/programmingocean.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=programmingocean.wordpress.com&amp;blog=8497817&amp;post=57&amp;subd=programmingocean&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://programmingocean.wordpress.com/2009/07/16/get-the-running-total-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/405a6ffef6b8b77a469b809b40fc5399?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">youngmurukan</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/windowfn.jpg" medium="image">
			<media:title type="html">Query</media:title>
		</media:content>

		<media:content url="http://programmingocean.files.wordpress.com/2009/07/window_res.jpg" medium="image">
			<media:title type="html">Query Result</media:title>
		</media:content>
	</item>
	</channel>
</rss>
