<?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>This is me,Elias Pathan</title>
	<atom:link href="http://mepathan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mepathan.wordpress.com</link>
	<description>Go an eXtra mile for an eXtra bit..</description>
	<lastBuildDate>Sun, 08 May 2011 04:52:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mepathan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/8df7f00a208899ef3293a50cc1f5d820?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>This is me,Elias Pathan</title>
		<link>http://mepathan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mepathan.wordpress.com/osd.xml" title="This is me,Elias Pathan" />
	<atom:link rel='hub' href='http://mepathan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>vs short cut</title>
		<link>http://mepathan.wordpress.com/2010/08/14/vs-short-cut/</link>
		<comments>http://mepathan.wordpress.com/2010/08/14/vs-short-cut/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 06:40:08 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Asp.net]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=205</guid>
		<description><![CDATA[1. CTRL + &#8220;.&#8221;: This is actually a shortcut for a shortcut. it is the same as CTRL + SHIFT + F10 which opens the smart tag window and allows you to add Using statementsAdd Using Statement Or implement interfaces Implement Interface and much more. 2. ALT + CTRL + &#8220;e&#8221;: This one will open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=205&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>   1.</p>
<p>      CTRL + &#8220;.&#8221;: This is actually a shortcut for a shortcut. it is the same as CTRL + SHIFT + F10 which opens the smart tag window and allows you to add Using statementsAdd Using Statement</p>
<p>      Or implement interfaces Implement Interface</p>
<p>      and much more.<br />
   2.</p>
<p>      ALT + CTRL + &#8220;e&#8221;:  This one will open the Exceptions window, which allows you to tell Visual Studio to halt at specific exceptions, halt on all exceptions or selecet some exceptions to ignore.</p>
<p>      Exception Popup Windows<br />
   3.</p>
<p>      CTRL + &#8220;k&#8221; + &#8220;f&#8221; and CRTL + &#8220;k&#8221; + &#8220;d&#8221;: these two will format the code in the window to be nicely indented. using &#8220;d&#8221; will format all the document while using &#8220;f&#8221; will format only selected text. The formatting is for all types of documents, HTML, Xaml, XML, C#… This one is my favorite.<br />
   4.</p>
<p>      SHIFT + Del: This one will cut the entire row from the document and past it to the clipboard. No need to select the row, just put the marker there and click SHIFT + Del and it is gone.<br />
   5.</p>
<p>      CTRL + &#8220;k&#8221; + &#8220;c&#8221; and CTRL + &#8220;k&#8221; + &#8220;u&#8221;: These two are for commenting selected text (the &#8220;c&#8221; options) and uncommenting selected text (the &#8220;u&#8221; option).<br />
   6.</p>
<p>      ALT + ENTER: this little shortcut will open up the Properties windowProperties Window<br />
   7.</p>
<p>      CTRL + &#8220;k&#8221; + &#8220;s&#8221;: This one opens up the code snippets dialogue within the code</p>
<p>      Open Snippets Dialogue</p>
<p>      If you want to create code snippets you should read my post about snippy the code snippets editor.<br />
   8.</p>
<p>      F12: I think you all know this but still F12 is the shortcut for the &#8220;Go to definition&#8221; command which will take you to the definition of the object your marker is currently on.<br />
   9.</p>
<p>      F9: Another one i think you all know, clicking on F9 will add a breakpoint to the code line your marker is currently at. Clicking F9 again will remove this breakpoint from that line.<br />
  10.</p>
<p>      CTRL + ALT + &#8220;q&#8221;: This one will open the Quick watch window while you debugOpen Quick Watch Window</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=205&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2010/08/14/vs-short-cut/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>How to calculate percent on base?</title>
		<link>http://mepathan.wordpress.com/2009/10/28/how-to-calculate-percent-on-base/</link>
		<comments>http://mepathan.wordpress.com/2009/10/28/how-to-calculate-percent-on-base/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 03:38:44 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Information Technology]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/2009/10/28/how-to-calculate-percent-on-base/</guid>
		<description><![CDATA[The following SQL Server T-SQL scripts illustrates the calculation of percent of orders by year and by country on base of all orders. The CONVERT function is used to format the percentage figures in currency format. USE AdventureWorks2008; GO &#8211; Calculate percent sql &#8211; SQL Server calculate percentage &#8211; sql convert percent SELECT YEAR=YEAR(OrderDate), Percentage [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=203&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The following SQL Server T-SQL scripts illustrates the calculation of percent of orders by year and by country on base of all orders. The CONVERT function is used to format the percentage figures in currency format.</p>
<p>USE AdventureWorks2008;</p>
<p>GO</p>
<p>&#8211; Calculate percent sql &#8211; SQL Server calculate percentage &#8211; sql convert percent</p>
<p>SELECT YEAR=YEAR(OrderDate),</p>
<p>        Percentage = convert(VARCHAR,convert(MONEY,100.0 * SUM(TotalDue) /</p>
<p>                          (SELECT SUM(TotalDue) FROM Sales.SalesOrderHeader)),1) + &#8216;%&#8217;</p>
<p>FROM Sales.SalesOrderHeader</p>
<p>GROUP BY YEAR(OrderDate)</p>
<p>ORDER BY YEAR ASC</p>
<p>GO</p>
<p>/*</p>
<p>YEAR  Percentage</p>
<p>2001  10.18%</p>
<p>2002  28.34%</p>
<p>2003  38.60%</p>
<p>2004  22.88%</p>
<p>*/</p>
<p>&#8212;&#8212;&#8212;&#8212;</p>
<p>USE Northwind;</p>
<p>GO</p>
<p>&#8211; SQL calculate percentage &#8211; calculate percentage sql</p>
<p>SELECT   Country,</p>
<p>           Percentage = convert(VARCHAR,convert(MONEY,100.0 * count(* ) /</p>
<p>                           (SELECT count(* ) FROM   Orders)), 1) + &#8216;%&#8217;</p>
<p>FROM      Customers c</p>
<p>           INNER JOIN Orders o</p>
<p>              ON c.CustomerID = o.CustomerID</p>
<p>GROUP BY Country</p>
<p>ORDER BY count(* ) DESC</p>
<p>GO</p>
<p>/* Partial results</p>
<p>Country      Percentage</p>
<p>USA          14.70%</p>
<p>Germany      14.70%</p>
<p>Brazil       10.00%</p>
<p>France       9.28%</p>
<p>UK           6.75%</p>
<p>Venezuela   5.54%</p>
<p>Austria      4.82%</p>
<p>*/</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=203&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/28/how-to-calculate-percent-on-base/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>The little used NULLIF function in sql server 2008</title>
		<link>http://mepathan.wordpress.com/2009/10/28/the-little-used-nullif-function-in-sql-server-2008/</link>
		<comments>http://mepathan.wordpress.com/2009/10/28/the-little-used-nullif-function-in-sql-server-2008/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 03:36:15 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Information Technology]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=201</guid>
		<description><![CDATA[Execute the following Microsoft SQL Server T-SQL scripts in Management Studio Query Editor to demonstrate the usage of NULLIF function. &#8211; SELECT NULLIF quick demo &#8211; Counts all, including ListPrice=0.0 SELECT COUNT(ListPrice) FROM AdventureWorks2008.Production.Product &#8211; 504 &#8211; Counts only when ListPrice != 0 &#8211; does not count NULLs (ListPrice = 0.0) SELECT COUNT(NULLIF(ListPrice,0.0)) FROM AdventureWorks2008.Production.Product [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=201&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Execute the following Microsoft SQL Server T-SQL scripts in Management Studio Query Editor to demonstrate the usage of NULLIF function.</p>
<p>&#8211; SELECT NULLIF quick demo</p>
<p>&#8211; Counts all, including ListPrice=0.0</p>
<p>SELECT COUNT(ListPrice)</p>
<p>FROM   AdventureWorks2008.Production.Product</p>
<p>&#8211; 504</p>
<p>&#8211; Counts only when ListPrice != 0 &#8211; does not count NULLs (ListPrice = 0.0)</p>
<p>SELECT COUNT(NULLIF(ListPrice,0.0))</p>
<p>FROM   AdventureWorks2008.Production.Product</p>
<p>&#8211; 304</p>
<p>&#8212;&#8212;&#8212;&#8212;</p>
<p>&#8211; SQL NULLIF: returns NULL when the two operands are equivalent, else the first one</p>
<p>&#8211; SQL COALESCE</p>
<p>USE tempdb</p>
<p>GO</p>
<p>CREATE TABLE Budget (</p>
<p>  BudgetID      TINYINT    IDENTITY,</p>
<p>  DepartmentID TINYINT,</p>
<p>  CurrentYear  DECIMAL    NULL,</p>
<p>  PriorYear    DECIMAL    NULL);</p>
<p>GO</p>
<p>INSERT Budget VALUES(10,2000000,1800000);</p>
<p>INSERT Budget VALUES(20,NULL,3000000);</p>
<p>INSERT Budget VALUES(30,0,8000000);</p>
<p>INSERT Budget VALUES(70,NULL,3500000);</p>
<p>INSERT Budget VALUES(90,6000000,6500000);</p>
<p>GO</p>
<p>SELECT * FROM Budget</p>
<p>GO</p>
<p>/*</p>
<p>BudgetID    DepartmentID       CurrentYear        PriorYear</p>
<p>1             10                   2000000             1800000</p>
<p>2             20                   NULL                 3000000</p>
<p>3             30                   0                     8000000</p>
<p>4             70                   NULL                 3500000</p>
<p>5             90                   6000000             6500000</p>
<p>*/</p>
<p>SELECT COALESCE(CurrentYear,PriorYear) AS &#8216;Yearly Budget&#8217;</p>
<p>FROM   Budget;</p>
<p>/*</p>
<p>Yearly Budget</p>
<p>2000000</p>
<p>3000000</p>
<p>0</p>
<p>3500000</p>
<p>6000000</p>
<p>*/</p>
<p>&#8211; SQL NULLIF changes 0 to NULL</p>
<p>SELECT NULLIF(COALESCE(CurrentYear,PriorYear),0.00) AS &#8216;Yearly Budget No Zeros&#8217;</p>
<p>FROM   Budget;</p>
<p>/*</p>
<p>Yearly Budget No Zeros</p>
<p>2000000</p>
<p>3000000</p>
<p>NULL</p>
<p>3500000</p>
<p>6000000</p>
<p>*/</p>
<p>&#8211; SQL NULLIF</p>
<p>SELECT AVG(NULLIF(COALESCE(CurrentYear,PriorYear),0.00)) AS &#8216;Average Yearly Budget&#8217;</p>
<p>FROM   Budget;</p>
<p>GO</p>
<p>/* Result</p>
<p>Average Yearly Budget</p>
<p>3625000.000000</p>
<p>*/</p>
<p>&#8211; Cleanup</p>
<p>DROP TABLE tempdb.dbo.Budget</p>
<p>GO</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=201&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/28/the-little-used-nullif-function-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>Pattern Matching with Patindex</title>
		<link>http://mepathan.wordpress.com/2009/10/28/pattern-matching-with-patindex/</link>
		<comments>http://mepathan.wordpress.com/2009/10/28/pattern-matching-with-patindex/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 03:34:17 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Ms SQL]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=199</guid>
		<description><![CDATA[Execute the following script in Query Editor to demonstrate the use of PATINDEX for complex search. The following search will find all bikes which off-road yet comfortable. use AdventureWorks2008; select ProductName=[Name], ProductNumber, [Description], ListPrice from [Production].[Product] p join [Production].[ProductModelProductDescriptionCulture] pmpdc on p.ProductModelID = pmpdc.ProductModelID join [Production].[ProductDescription] pd on pmpdc.ProductDescriptionID = pd.ProductDescriptionID where patindex( &#8216;%off-road%comfortable%&#8217;, pd.[Description]) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=199&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Execute the following script in Query Editor to demonstrate the use of PATINDEX for complex search. The following search will find all bikes which off-road yet comfortable.</p>
<p>use AdventureWorks2008;</p>
<p>select ProductName=[Name], ProductNumber, [Description], ListPrice</p>
<p>from [Production].[Product] p</p>
<p>   join [Production].[ProductModelProductDescriptionCulture] pmpdc</p>
<p>          on p.ProductModelID = pmpdc.ProductModelID</p>
<p>   join  [Production].[ProductDescription] pd</p>
<p>          on pmpdc.ProductDescriptionID = pd.ProductDescriptionID</p>
<p>where patindex( &#8216;%off-road%comfortable%&#8217;, pd.[Description]) &gt; 0</p>
<p>Partial results:<br />
ProductName 	ProductNumber 	Description 	ListPrice<br />
Mountain-500 Silver, 40 	BK-M18S-40 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	564.99<br />
Mountain-500 Silver, 42 	BK-M18S-42 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	564.99<br />
Mountain-500 Silver, 44 	BK-M18S-44 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	564.99<br />
Mountain-500 Silver, 48 	BK-M18S-48 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	564.99<br />
Mountain-500 Silver, 52 	BK-M18S-52 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	564.99<br />
Mountain-500 Black, 40 	BK-M18B-40 	Suitable for any type of riding, on or off-road. Fits any budget. Smooth-shifting with a comfortable ride. 	539.99</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=199&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/28/pattern-matching-with-patindex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up Access as Linked Server</title>
		<link>http://mepathan.wordpress.com/2009/10/28/setting-up-access-as-linked-server/</link>
		<comments>http://mepathan.wordpress.com/2009/10/28/setting-up-access-as-linked-server/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 03:29:37 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Ms SQL]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=197</guid>
		<description><![CDATA[You can establish an Access database as a linked server to Microsoft SQL Server and query it with OPENQUERY. Here are some setup examples: EXEC sp_addlinkedserver @server = &#8216;Warehouse&#8217;, @provider = &#8216;Microsoft.Jet.OLEDB.4.0&#8242;, @srvproduct = &#8216;OLE DB Provider for Jet&#8217;, @datasrc = &#8216;e:\access\warehouse.mdb&#8217; GO SQL Server linked server setup to Access 2007 database: EXEC sp_addlinkedserver @server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=197&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can establish an Access database as a linked server to Microsoft SQL Server and query it with OPENQUERY. Here are some setup examples:</p>
<p>EXEC sp_addlinkedserver<br />
  @server = &#8216;Warehouse&#8217;,<br />
  @provider = &#8216;Microsoft.Jet.OLEDB.4.0&#8242;,<br />
  @srvproduct = &#8216;OLE DB Provider for Jet&#8217;,<br />
  @datasrc = &#8216;e:\access\warehouse.mdb&#8217;<br />
GO</p>
<p>SQL Server linked server setup to Access 2007 database:</p>
<p>EXEC sp_addlinkedserver<br />
  @server = &#8216;NYCInventory&#8217;,<br />
  @provider = Microsoft.ACE.OLEDB.12.0&#8242;,<br />
  @srvproduct = &#8216;OLE DB Provider for ACE&#8217;,<br />
  @datasrc = &#8216;e:\access\nycwarehouse.accdb&#8217;<br />
GO</p>
<p>This is how you can query a linked Access database:</p>
<p>SELECT * FROM OPENQUERY(Warehouse, &#8216;SELECT SKU, Item, Description, Quantity FROM dbo.Inventory&#8217;)<br />
GO</p>
<p>source:SQL USA</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/197/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=197&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/28/setting-up-access-as-linked-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>oracle functions</title>
		<link>http://mepathan.wordpress.com/2009/10/22/oracle-functions/</link>
		<comments>http://mepathan.wordpress.com/2009/10/22/oracle-functions/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 11:45:39 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=195</guid>
		<description><![CDATA[Oracle functions: Single-Row Functions: -Manipulates Data Items -Accepts arguments and return one value -Act on each row returned. -Return one result per row -May modify the data type -can be nested. -Accepts arguments which can be a column or an expression. Syntax: Function_name [(arg1,arg2,….)] Single row functions are as below: Character functions: &#8212;-Case-manipulation functions a. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=195&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Oracle functions:</p>
<p>Single-Row Functions:<br />
-Manipulates  Data Items<br />
-Accepts arguments and return one value<br />
-Act on each row returned.<br />
-Return one result per row<br />
-May modify the data type<br />
-can be nested.<br />
-Accepts arguments which can  be a column or an expression.<br />
Syntax:<br />
Function_name [(arg1,arg2,….)]                 </p>
<p>Single row functions are as below:<br />
Character functions:<br />
&#8212;-Case-manipulation  functions<br />
      a. LOWER    e.g [LOWER (‘QA COURSE’)  =&gt; qa course]<br />
      b. UPPER      e.g [UPPER (‘qa course’)           =&gt;QA COURSE]<br />
            c.  INITCAP  e.g [INITCAP(‘QA COURSE ’)=&gt;Qa course]</p>
<p>     &#8212;&#8211;Character-manipulation functions<br />
a.	CONCAT e.g   [CONCAT (‘Hello’,’World’)       =&gt;HelloWorld]<br />
b.	SUBSTR   e.g  [SUBSTR (‘HelloWorld’,1,5)       =&gt;Hello         ]<br />
c.	LENGTH  e.g  [LENGTH (‘HelloWorld’)            =&gt;10              ]<br />
d.	INSTR       e.g  [INSTR (‘HelloWorld’,’W’)        =&gt;6                ]<br />
e.	LPAD       e.g   [LPAD (salary,10,’*’)                  =&gt;*****24000]<br />
f.	RPAD       e.g  [RPAD(salary,10,’*’)                    =&gt;24000*****]<br />
g.	TRIM        e.g  [‘H’ FROM ‘HelloWorld’            =&gt;elloworld]<br />
h.	REPLACE<br />
    EXAMPLE:<br />
 SELECT employee_id,CONCAT(first_name,last_name) NAME,job_id,LENGTH    (last_name),INSTR (last_name,’a’) “Contains ‘a’?”<br />
FROM    employees<br />
WHERE  SUBSTR(job_id,4) =’REP’;</p>
<p>&#8212;&#8211;Number Functions </p>
<p>         a. ROUND (45.926 ,2)     =&gt;45.93<br />
         b. TRUNC (45.926 ,2)     =&gt;45.92<br />
         c. MOD       (1600,300)     =&gt;100</p>
<p>&#8212;&#8211;Date Functions<br />
       SYSDATE is a function that returns<br />
       &#8211;Date<br />
       &#8211;Time</p>
<p>-MONTHS_BETWEEN (’01-SEP-95’,’11-JAN-94’)     =&gt; 19.6774194<br />
-ADD_MONTHS           (’11-JAN-94’,6)                        =&gt;’11-JUL-94’<br />
-NEXT_DAY                  (’01-SEP-95’,’FRIDAY’)        =&gt;’08-SEP-95’<br />
-LAST_DAY                    (’01-FEB-95’)                        =&gt;’28-FEB-95’</p>
<p>   &#8212;-Conversion Functions:<br />
a.	Implicit data type conversion.<br />
b.	Explicit  data type conversion.</p>
<p>Implicit data conversion of those Oracle server can automatically convert.</p>
<p>e.g<br />
VARCHAR2 OR CHAR =&gt;NUMBER<br />
VARCHAR2  OR CHAR=&gt;DATE<br />
NUMBER                        =&gt;VARCHAR2<br />
DATE                              =&gt;VARCHAR2</p>
<p>Explicit Data type Conversion  occurred when  opposite above.<br />
e.g<br />
SELECT  last_name,TO_CHAR(hire_date,’fmDD Month YYYY’) as HIREDATE<br />
From empoyees;</p>
<p>General Functions:<br />
&#8211;NVL<br />
&#8211;NVL2<br />
&#8211;NULLIF<br />
&#8211;COALESCE</p>
<p>I will discuss details in my next post</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/195/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/195/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/195/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=195&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/22/oracle-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>Uninstall SQL server 2005</title>
		<link>http://mepathan.wordpress.com/2009/10/22/uninstall-sql-server-2005/</link>
		<comments>http://mepathan.wordpress.com/2009/10/22/uninstall-sql-server-2005/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 09:06:04 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Ms SQL]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=190</guid>
		<description><![CDATA[How to uninstall MS SQL Server 2005 manually??? Backup all databases, if you have any, before you uninstall the application. Also save a copy of all the data and of all the log files. Also, be careful when you play around with the Windows registry files, while using Registry Editor. Its probably a good idea [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=190&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How to uninstall MS SQL Server 2005 manually???<br />
Backup all databases, if you have any, before you uninstall the application. Also save a copy of all the data and of all the log files.<br />
Also, be careful when you play around with the Windows registry files, while using Registry Editor. Its probably a good idea to take a backup of your registry.<br />
STEP 1: Make sure you have you have ‘Microsoft SQL Server Setup Support Files component’ installed in the server.<br />
Open ‘Add/Remove Programs’ and check whether Microsoft SQL Server Setup Support Files component is listed there, if it’s there you can proceed to Step 2.<br />
Otherwise, you will have to install it from the MS SQL Server 2005 installation media.<br />
STEP 2: Run “C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe” /Remove &#8211; in the command prompt.<br />
This will evoke the MS SQL Uninstall program and uninstall all the MS SQL server components one by one.<br />
If you experience problems here and you are not able to remove ‘MS SQL Server 2005′ from the Server. The last hope is seeking the help of Window’s registry file.<br />
Start the Window’s Registry Editor and look for the registry key: ‘HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall’<br />
On the left side of the Registry Editor, you will be able to see so many GUIDs, one after another. {26F1A218-3158-4107-B3A6-37FD61CEE969} &#8211; This is how a GUID looks like.<br />
Click on each GUID, you will be able to see the details of each GUID on the right pane or side of the Registry Editor. Look out for the GUID that gives out ‘Microsoft SQL Server 2005′ in the ‘Display Name’ details.<br />
For each GUID related to ‘Microsoft SQL Server 2005′, run this command in the command prompt.<br />
start /wait msiexec /x {GUID} /l*v c:\sql_uninstall.log<br />
For eg: start /wait msiexec /x {26F1A218-3158-4107-B3A6-37FD61CEE969} /l*v c:\sql_uninstall.log<br />
(You can copy a GUID name by right clicking on the GUID on the left pane or side of Registry Editor)<br />
c:\sql_uninstall.log &#8211; stores the uninstall logs<br />
This should uninstall the Microsoft SQL Server 2005 without much problem.<br />
STEP 3: Now it’s time to uninstall the support components.<br />
Unistall them in the order specified below:<br />
- MSXML 6.0 Parser<br />
- SQLXML4<br />
- Microsoft SQL Server VSS Writer<br />
- Microsoft SQL Server 2005 Backward Compatibility<br />
- Anything else that is related to SQL Server 2005, except for the Microsoft SQL Server Native Client component and for the Microsoft SQL Server Setup Support Files component.<br />
If any of the components fail to uninstall, you will have to seek the help of Registry Editor and uninstall them using the GUID for each component.<br />
a. Start the Registry Editor and locate the registry key:<br />
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall<br />
b. Click on each GUID, you will be able to see the details of each GUID on the right pane or side of the Registry Editor. Look out for the details of MS SQL support components, listed above.<br />
c. For each GUID, to uninstall, run the command below:<br />
start /wait msiexec /x {GUID} SKIPREDISTPREREQS=1 /l*v c:\sqlredist_uninstall.log<br />
STEP 4: Uninstall the Microsoft SQL Server Native Client component using Add/Remove Programs.<br />
STEP 5: Uninstall the Microsoft SQL Server Setup Support Files component Add/Remove Programs.</p>
<p>source:The Crucial Blog</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/190/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/190/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/190/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=190&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/22/uninstall-sql-server-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>Oracle&#8217;s Joins</title>
		<link>http://mepathan.wordpress.com/2009/10/22/186/</link>
		<comments>http://mepathan.wordpress.com/2009/10/22/186/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 08:26:27 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/2009/10/22/186/</guid>
		<description><![CDATA[Joins in Oracle(8i &#38; prior): Equijoin Non-equijoin Outer join Self Join. We have to use a join to query a data from more than one table. Note:To join N tables together ,we need a minimum of n-1 join conditions. Equijoin: Equijoin retrieves the data those are exact match of the tables queried. It is also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=186&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Joins in Oracle(8i &amp; prior):<br />
Equijoin<br />
Non-equijoin<br />
Outer join<br />
Self Join.</p>
<p>We have to  use a join to query a data from more than one table.<br />
Note:To join N tables together ,we need a minimum of n-1 join conditions.</p>
<p>Equijoin:<br />
Equijoin retrieves the data those are exact match of the tables queried.<br />
It is also called simple join or inner join.</p>
<p>Retrieving Records with Equijoins:<br />
SELECT e.employee_id,e.last_name,e.department_id,d.department_id<br />
FROM employees e, departments d<br />
Where e.department_id = d.department_id;</p>
<p>Non-Equijoins:<br />
A non-equijoin is a join condition containing something other than an equality operator.<br />
[we need to create a table JOB_GRADES having fields GRA,LOWEST_SAL,HIGHEST_SAL]<br />
e.g<br />
SELECT e.last_name,e.salary,j.grade_level<br />
FROM    employees e,job_grades j<br />
Where    e.salary<br />
	  Between j.lowest_sal and j.highest_sal;</p>
<p>Outer Joins:<br />
We all are known about outer join using (+) operator.<br />
Hence I am not discussing it.Rather I am showing it bit different ways.</p>
<p>LEFT OUTER JOIN:<br />
e.g<br />
SELECT e.last_name,e.department_id,d.department_name<br />
FROM  employees e<br />
LEFT OUTER JOIN department d<br />
ON (e.department_id =d.department_id);</p>
<p>This query will retrieves all rows in the EMPLOYEES table, which is the left table even if there is no match in the DEPARTMENTS table.</p>
<p>The same query using (+) operator is as below</p>
<p>SELECT e.last_name,e.department_id,d.department_name<br />
FROM employees e, departments<br />
WHERE e.department_id =d. department_id(+)</p>
<p>The right Outer Join is vice verse. Hence I am not discussing on it.</p>
<p>    * Full Outer Join:</p>
<p>Full Outer join is combination of Left Outer join as well as Right outer Join.<br />
e.g<br />
SELECT e.last_name,d.department_name<br />
FROM   employees e<br />
FULL OUTER JOIN departments d<br />
on (e.department_id = d.department_id);</p>
<p>The above query retrieves all rows in the EMPLOYEES table ,even if ther is no match in the DEPARTMENTs table as well as retrieves all rows in the DEPARTMENTS table,even if there is no match in the EMPLOYEES table.</p>
<p>Self Join:<br />
Sometimes we need to join a table to itself.<br />
e.g.<br />
Q.find out the managers name of employees</p>
<p>SELECT worker.last_name || ‘works for ’ ||manager.last_name<br />
FROM    employees worker,employees manager<br />
WHERE worker.manager_id = manager.employees_id;</p>
<p>o/p<br />
Mourgos  works for King</p>
<p>Cross Join:</p>
<p>The CROSS JOIN clause produces the cross-product of two tables.<br />
This is the same as Cartesian product(as an IT people  we know what is Cartesian product ery well) between the two tables.<br />
e.g<br />
SELECT last_name ,department_name<br />
FROM    employees, departments;</p>
<p>source:Oracle Education</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/186/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=186&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/22/186/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>View in Oracle</title>
		<link>http://mepathan.wordpress.com/2009/10/22/view-in-oracle/</link>
		<comments>http://mepathan.wordpress.com/2009/10/22/view-in-oracle/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 04:43:58 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=180</guid>
		<description><![CDATA[In this post I am trying to discuss with an important object in Oracle i.e View. What is view: View logically represents subsets of data from one or more tables. It’s a logical table based on a table or another view. A view contains no data of its own like table but its like a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=180&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post I am trying to discuss with an important object in Oracle i.e View.<br />
What is view:<br />
View logically represents subsets of data from one or more tables. It’s a logical table based on a table or another view. A view contains no data of its own like table but its like a window through which data from table can be viewed or changed. The tables on which a view is based are   called base table.The view is stored as a select statement in the data dictionary.</p>
<p>Why Use Views:<br />
-To restrict* data access<br />
-To make complex query easy<br />
-To provide data Independence**<br />
-To represent different views of the same data.<br />
*View restrict access to the data because the view can display selective columns from the table. We can give privilege  to the user to access of a particular column using  view. Some times It needs to give privilege some certain fields to the user instead of a whole table.<br />
**Views provide data independence for ad hoc users &amp; application programs. One view can be used to retrieve data from several tables.</p>
<p>Types of Views:<br />
There are two classifications of views.Simple &amp; Complex.The basic difference is related to the DML operations. I am depicting a comparative feature below.</p>
<p>Table:</p>
<p>We all know how to create a view .Still I am giving the basic syntax of creating a view.</p>
<p>CREATE [OR REPLACE] [FORCE|NOFORCE]  VIEW viewname<br />
AS subquery<br />
[(alias[ , alias]….)]<br />
[WITH CHECK  OPTION [CONSTRAINT constraintname ]]<br />
[WITH READ ONLY [CONSTRAINT constraintname ]];</p>
<p>-OR REPLACE         		 re-creates the view if it already exists.<br />
-FORCE	creates the view regardless of whether or not the  base tables   exist<br />
-NOFORCE	create the view iff(if and only if) the the base table exist.(this is default)<br />
alias	specifies names for the expressions selected by the view’s query(The number of aliases must match the number of expressions selected by the view)<br />
-subquery                   		 The subquery can contain complex Select syntax.<br />
-WITH CHECK OPTION       specifies that only rows accessible to the view can be<br />
                                                 inserted or updated.<br />
-constraint                                is the assigned to the CHECK OPTION constraint.<br />
-WITH READ ONLY	ensures that no DML operations can be performed on    view.</p>
<p>e.g.<br />
CREATE VIEW salvu80<br />
AS SELECT employee_id ID_NUMBER,last_name NAME,salary*12 ANN_SALARY<br />
FROM employees<br />
WHERE department_id = 50;</p>
<p>Retrieving Data from a View</p>
<p>SELECT *<br />
FROM salvu80;</p>
<p>Views in the Data Dictionary:<br />
                                      Once our view has been created, We can query the data dictionary view called  USER_VIEWS to see the name of the view and the view definition. The text of the SELECT statement that constitutes .Our view is stored in a LONG column.</p>
<p>Data Access Using Views:<br />
When We access data using a view, the Oracle server performs the following operations:</p>
<p>1. It retrieves the view definition from the data dictionary table USER_VIEWS.<br />
2. It checks access privileges for the view base table.<br />
                              3. It converts the view query into an equivalent operation on the underlying base table or tables. In other words, data is retrieved from or an update is made to, the base tables.</p>
<p>Modifying a View:<br />
Suppose we have a view named empvu80<br />
Modify the empvu80 view by using CREATE OR REPLACE VIEW clause. Add an alias for each column name.</p>
<p>CREATE OR REPLACE VIEW empvu80<br />
    (id_number,name,sal,department_id)<br />
AS SELECT employee_id,first_name || ‘ ‘|| last_name,salary,department_id<br />
            FROM    employees<br />
            WHERE department_id = 80; </p>
<p>Note:<br />
With the OR REPLACE option, a view can be created even if one exist s with this name already, thus replacing the old version of the view for its owner. This means that the view can be altered without dropping, re-creating and regranting object privileges.<br />
when assigning column aliases in the CREATE VIEW clause ,we have to remember that the aliases are listed in the same order as  the columns in the subquery. </p>
<p>Creating a complex View:<br />
It is an example to create a complex view that contains group functions to display values from two tables.</p>
<p>CREATE VIEW dept_sum_vu<br />
              (name, minsal, maxsal, avgsal)<br />
AS SELECT d.department_name,MIN(e.salary),MAX(e.salary),AVG(e.salary)<br />
   FROM           employees e,department d<br />
   WHERE         e.department_id =d.department_id<br />
    GROUP BY   d.department_name;</p>
<p>Rules for performing DML Operations on a view</p>
<p>-We can perform DML operation on simple views.<br />
-We cannot remove a row if the view contains the following:<br />
      -Group functions.<br />
      -A GROUP BY clause.<br />
      -The Distinct Keyword.<br />
      -The pseudocolumn* ROWNUM keyword.</p>
<p>-We Cannot modify data in a view if it contains<br />
      -Group functions.<br />
      -A GROUP BY clause.<br />
      -The Distinct Keyword.<br />
      -The pseudocolumn ROWNUM keyword.<br />
      -Columns defined by expressions(e.g salary * 12)<br />
-We Cannot add data through a view if the view includes<br />
        -Group functions.<br />
      -A GROUP BY clause.<br />
      -The Distinct Keyword.<br />
      -The pseudocolumn ROWNUM keyword.<br />
      -NOT NULL columns in the base tables that are not selected by the view.<br />
(We can  add data through a view unless it contains any of the items listed above or there are NOT NULL colums without default values in the base table that are not selected by the view. All required values must be present in the view. We have to remember that we are adding values directly into the underlying table through the view )</p>
<p>*[ A pseudo column is an item of data which does not belong in any particular table but which can be treated as if it did.e.g<br />
rowid,versions_xid,versions_operation,versions_startscn,versions_starttime,versions_endscn,versions_endtime ,sysdate,systimestamp,rownum ,ora_rowscn,object_value etc ]</p>
<p>                                   Denying DML Operations:<br />
                                  -We can ensure that no DML operations occur by adding the WITH READ ONLY option to Wer view definition.<br />
                                  &#8211; Any attempt to perform a DML on any row  in the view results in an Oracle server error.</p>
<p>                                  e.g<br />
                                  CREATE OR REPLACE VIEW empvu10<br />
 		(employee_number,employee_name,job_title)<br />
	AS SELECT employee_id,last_name,job_id<br />
		From 	employees<br />
	WHERE department_id = 10<br />
	WITH READ ONLY;</p>
<p>                                  ERRORS:<br />
		DELETE FROM empvu10<br />
		WHERE employee_number = 200;</p>
<p>	ERROR at line 1:<br />
	ORA – 01752 :cannot delete from view without exactly one key-preserved table</p>
<p>	Any attempt to insert a row or modify a row using theview with s read-only constraint results in a Oracle server error:<br />
	01733:virtual column not allowed here.</p>
<p>	Removing a View:<br />
DROP VIEW viewname;<br />
e.g<br />
DROP VIEW empvu80;</p>
<p>INLINE VIEWS:	</p>
<p>-An inline view is a subquery with sn alias (or correlation name) that We can use within a SQL statement.<br />
-A named subquery in the FROM clause  of the main query is an example of an inline view.<br />
-An Inline view is not a schema* object.</p>
<p>e.g</p>
<p>SELECT a.last_name,a.salary,a.department_id,b.maxsal<br />
FROM   employees a (select department_id,max(salary), maxsal<br />
			   From employees<br />
                                    GROUP BY department_id	)  b<br />
WHERE	 a.department_id =b.department_id<br />
AND             a.salary &lt;b.maxsal;</p>
<p>The above example will display the employees  last name, salary  ,their department id &amp; the maximum salary of that department as well.</p>
<p>Using the WITH CHECK OPTION Clause<br />
We can ensure that DML operations performed on the view stay within the domain of the view by using the WITH CHECK OPTION clause.</p>
<p>CREATE OR REPLACE VIEW empvu80<br />
AS SELECT *<br />
    FROM employees<br />
    WHERE department_id =20<br />
    WITH CHECK OPTION CONSTARINT empvu20_ck;<br />
-any attempt to change the department number for any row in the view fails because it violates the WITH CHECK OPTION constraint.<br />
e.g<br />
UPDATE empvu20<br />
 SET   department_id = 10<br />
 WHERE employee_id =20;</p>
<p>UPDATE empvu20<br />
    *<br />
ERROR at line 1:<br />
ORA &#8211; 01402 : view WITH CHECK OPTION where-clause violation</p>
<p>source:Oracle Education.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/180/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/180/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/180/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=180&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/10/22/view-in-oracle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
		<item>
		<title>Short Cut to Switching between Design view &amp; Source View</title>
		<link>http://mepathan.wordpress.com/2009/09/09/short-cut-to-switching-between-design-view-source-view/</link>
		<comments>http://mepathan.wordpress.com/2009/09/09/short-cut-to-switching-between-design-view-source-view/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 05:45:32 +0000</pubDate>
		<dc:creator>mepathan</dc:creator>
				<category><![CDATA[Asp.net]]></category>

		<guid isPermaLink="false">http://mepathan.wordpress.com/?p=174</guid>
		<description><![CDATA[Press CTRL-PageUp or CTRL-PageDown<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=174&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Press CTRL-PageUp or CTRL-PageDown</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mepathan.wordpress.com/174/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mepathan.wordpress.com/174/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mepathan.wordpress.com/174/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mepathan.wordpress.com&amp;blog=8011724&amp;post=174&amp;subd=mepathan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mepathan.wordpress.com/2009/09/09/short-cut-to-switching-between-design-view-source-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b1d3e2c64a95696da978887c409bf67c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">elias</media:title>
		</media:content>
	</item>
	</channel>
</rss>
