<?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>aag&#039;s blogs</title>
	<atom:link href="http://amolgade.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://amolgade.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sat, 22 Aug 2009 06:26:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='amolgade.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>aag&#039;s blogs</title>
		<link>http://amolgade.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://amolgade.wordpress.com/osd.xml" title="aag&#039;s blogs" />
	<atom:link rel='hub' href='http://amolgade.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to put an xml document into a SQL table using T-SQL</title>
		<link>http://amolgade.wordpress.com/2009/08/22/how-to-put-an-xml-document-into-a-sql-table-using-t-sql/</link>
		<comments>http://amolgade.wordpress.com/2009/08/22/how-to-put-an-xml-document-into-a-sql-table-using-t-sql/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 06:26:35 +0000</pubDate>
		<dc:creator>amolgade</dc:creator>
				<category><![CDATA[SQL SERVER 2005]]></category>

		<guid isPermaLink="false">http://amolgade.wordpress.com/?p=11</guid>
		<description><![CDATA[The procedure is simple you just need a well formed xml document. I have used a smlple document here is th code for you: DECLARE @xmlDoc NVARCHAR(MAX) DECLARE @handle INT SET @xmlDoc = N&#8217;&#60;root&#62; &#60;student&#62; &#60;name&#62;amol&#60;/name&#62; &#60;standard&#62;10&#60;/standard&#62; &#60;division&#62;A&#60;/division&#62; &#60;/student&#62; &#60;student&#62; &#60;name&#62;Alok&#60;/name&#62; &#60;standard&#62;10&#60;/standard&#62; &#60;division&#62;A&#60;/division&#62; &#60;/student&#62; &#60;student&#62; &#60;name&#62;Bhavesh&#60;/name&#62; &#60;standard&#62;10&#60;/standard&#62; &#60;division&#62;B&#60;/division&#62; &#60;/student&#62; &#60;/root&#62;&#8217; EXEC sp_xml_preparedocument @handle OUTPUT, @xmlDoc [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=11&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The procedure is simple you just need a well formed xml document. I have used a smlple document here is th code for you:</p>
<p>DECLARE @xmlDoc NVARCHAR(MAX)<br />
DECLARE @handle INT<br />
SET @xmlDoc = N&#8217;&lt;root&gt;</p>
<p>&lt;student&gt;<br />
&lt;name&gt;amol&lt;/name&gt;<br />
&lt;standard&gt;10&lt;/standard&gt;<br />
&lt;division&gt;A&lt;/division&gt;<br />
&lt;/student&gt;</p>
<p>&lt;student&gt;<br />
&lt;name&gt;Alok&lt;/name&gt;<br />
&lt;standard&gt;10&lt;/standard&gt;<br />
&lt;division&gt;A&lt;/division&gt;<br />
&lt;/student&gt;<br />
&lt;student&gt;<br />
&lt;name&gt;Bhavesh&lt;/name&gt;<br />
&lt;standard&gt;10&lt;/standard&gt;<br />
&lt;division&gt;B&lt;/division&gt;<br />
&lt;/student&gt;<br />
&lt;/root&gt;&#8217;</p>
<p>EXEC sp_xml_preparedocument @handle OUTPUT, @xmlDoc<br />
SELECT *into xml_tbl1 FROM OPENXML (@handle, &#8216;/root/student&#8217;, 2) WITH   &#8212;-SELECT INTO xml_tbl1  CREATES A NEW table<br />
(<br />
name varchar(50),<br />
standard int,<br />
division varchar(1)<br />
)<br />
EXEC sp_xml_removedocument @handle</p>
<p>you first to create space for Xml document in sql server and a handle for it which is like a pointer ,then you need to parse the xml document using &#8220;sp_xml_preparedocument&#8221; then you need to remove the handle by executing &#8220;sp_xml_removedocument&#8221; .and you are done ,what i have done is that ,I`ve stored the output into &#8220;xml_tbl1&#8243;.</p>
<p>Note: table definition attributes mentioned with &#8220;with&#8221; statement should exactly  match the tags in xml.</p>
<p>query     : select * from xml_tbl1</p>
<p>output:</p>
<p>amol            10    A<br />
Alok             10    A<br />
Bhavesh        10    B</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amolgade.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amolgade.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amolgade.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=11&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://amolgade.wordpress.com/2009/08/22/how-to-put-an-xml-document-into-a-sql-table-using-t-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a46cfe1df2e8b3e039485acd5ff72430?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">amolgade</media:title>
		</media:content>
	</item>
		<item>
		<title>how to calculate exact age of a person in years and months.</title>
		<link>http://amolgade.wordpress.com/2009/08/21/how-to-calculate-exact-age-of-a-person-in-years-and-months/</link>
		<comments>http://amolgade.wordpress.com/2009/08/21/how-to-calculate-exact-age-of-a-person-in-years-and-months/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 12:56:01 +0000</pubDate>
		<dc:creator>amolgade</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://amolgade.wordpress.com/?p=3</guid>
		<description><![CDATA[This is my first blog on SQL server 2005, hope you like it.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=3&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was facing a problem in SQL server 2005 when i was calculating present age by comapring present year and year of birth.I found that there is no built in function in SQL SERVER 2005 which would calculate exact age in years and months, so i have designed a code in T-SQL for the same .The code is simple to understand and implement. First let me show you the table on which i am going to implement the code:</p>
<p>School table:</p>
<p><strong>roll        fname                                    DOB<br />
</strong></p>
<p>101          aakash                  1990-01-01 00:00:00.000<br />
102         amol                      1990-02-04 00:00:00.000<br />
103         bahadur               1990-11-22 00:00:00.000<br />
104         chatanya             1990-12-01 00:00:00.000<br />
<strong><em>105        dinesh               1991-12-12 00:00:00.000</em></strong><br />
106         Elton                     1990-04-03 00:00:00.000<br />
107        Ferdinand            1990-12-31 00:00:00.000<br />
108        Farookh                1990-12-04 00:00:00.000</p>
<p>Now take a close look at roll 105  his age shud be 19 years and let us calculate his age by using SQL &#8220;datediff()&#8221;</p>
<p>Query        :-   select datediff(YY,@dob,getdate()) As&#8217;Age&#8217;</p>
<p>Output      :-   20</p>
<p>Solution   :-</p>
<p>select * from student where rollno=105</p>
<p>use DB_trainee<br />
declare @i int,@dob datetime<br />
select @dob= dob from dbo.student where rollno=105&#8211;pass DOB of roll 101 to var @DOB</p>
<p>SET @i=datediff(mm,@dob,getdate())&#8211; differentiate acc to month</p>
<p>declare @year int,@month int<br />
set @year=@i/12<br />
set @month=(@i%12)<br />
SELECT (cast(@year as varchar(20)))+&#8217; years and &#8216;+(cast(@month as varchar(20)))+&#8217; months&#8217; as &#8216;AGE&#8217;</p>
<p>select datediff(YY,@dob,getdate()) As&#8217;Age&#8217;</p>
<p>Here is tyhe output of the query  :-</p>
<p>record   of  roll 105            :-    1    105    Dinesh    DBA      1989-12-12 00:00:00.000</p>
<p>output with  my solution :-    19 years and 8 months</p>
<p>output with SQL fun           :-    20</p>
<p>You can observe the difference.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amolgade.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amolgade.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amolgade.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=3&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://amolgade.wordpress.com/2009/08/21/how-to-calculate-exact-age-of-a-person-in-years-and-months/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a46cfe1df2e8b3e039485acd5ff72430?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">amolgade</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://amolgade.wordpress.com/2009/08/21/hello-world/</link>
		<comments>http://amolgade.wordpress.com/2009/08/21/hello-world/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 12:28:44 +0000</pubDate>
		<dc:creator>amolgade</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=1&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/amolgade.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/amolgade.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/amolgade.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=amolgade.wordpress.com&amp;blog=9108059&amp;post=1&amp;subd=amolgade&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://amolgade.wordpress.com/2009/08/21/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a46cfe1df2e8b3e039485acd5ff72430?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">amolgade</media:title>
		</media:content>
	</item>
	</channel>
</rss>
