<?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>Sqljunkieshare</title>
	<atom:link href="http://sqljunkieshare.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqljunkieshare.com</link>
	<description></description>
	<lastBuildDate>Fri, 10 May 2013 15:14:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sqljunkieshare.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sqljunkieshare</title>
		<link>http://sqljunkieshare.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sqljunkieshare.com/osd.xml" title="Sqljunkieshare" />
	<atom:link rel='hub' href='http://sqljunkieshare.com/?pushpress=hub'/>
		<item>
		<title>Creating, querying, tuning hierarchical ROLAP cubes in Oracle</title>
		<link>http://sqljunkieshare.com/2013/04/25/creating-querying-tuning-hierarchical-rolap-cubes-in-oracle/</link>
		<comments>http://sqljunkieshare.com/2013/04/25/creating-querying-tuning-hierarchical-rolap-cubes-in-oracle/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 01:20:46 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[data marts]]></category>
		<category><![CDATA[enterprise data warehouse]]></category>
		<category><![CDATA[olap cubes]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1234</guid>
		<description><![CDATA[This post will explain how to  use  Oracle grouping functions to leverage ROLAP capability in Oracle To begin with some introduction Multi dimensional data marts or an Enterprise data warehouse has become need than necessity as in the end data that drives the business Having right staging area and presentation layer is very important, there are many Bi tools [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1234&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This post will explain how to  use  Oracle grouping functions to leverage ROLAP capability in Oracle</p>
<p>To begin with some introduction Multi dimensional data marts or an Enterprise data warehouse has become need than necessity as in the end data that drives the business</p>
<p>Having right staging area and presentation layer is very important, there are many Bi tools out there these tools helps the users to create multi dimensional OLAP cubes up on statging layer by MOLAP, ROLAP, HOLAP</p>
<p>indepth analysis of these storage methods are outside the scope of our discussion</p>
<p><b>ROLAP</b> stands for <b>R</b>elational <b>O</b>n<b>l</b>ine <b>A</b>nalytical <b>P</b>rocessing</p>
<p>ROLAP features</p>
<ul>
<li>ROLAP is considered to be more scalable in handling large data volumes, especially models with dimensions with very high cardinality (i.e., millions of members).</li>
</ul>
<ul>
<li>With a variety of data loading tools available, and the ability to fine tune the ETL code to the particular data model, load times are generally much shorter than with the automated MOLAP loads.</li>
</ul>
<ul>
<li>The data are stored in a standard relational database and can be accessed by any SQL reporting tool (the tool does not have to be an OLAP tool).</li>
</ul>
<ul>
<li>ROLAP tools are better at handling <i>non-aggregatable facts</i> (e.g., textual descriptions). MOLAP tools tend to suffer from slow performance when querying these elements.</li>
</ul>
<ul>
<li>By decoupling the data storage from the multi-dimensional model, it is possible to successfully model data that would not otherwise fit into a strict dimensional model.</li>
</ul>
<ul>
<li>The ROLAP approach can leverage database authorization controls such as row-level security, whereby the query results are filtered depending on preset criteria applied, for example, to a given user or group of users (SQL WHERE clause).</li>
</ul>
<p>ROLAP simplifies the report and analysis development by 100 times when compared to MOLAP</p>
<p>Oracle Provides following grouping functions</p>
<ul>
<li><span style="line-height:13px;">ROLLUP</span></li>
<li>CUBE</li>
<li>GROUPING SETS</li>
</ul>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-over-view.jpg"><img class="alignleft size-full wp-image-1273" alt="Rolap cube over view" src="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-over-view.jpg?w=620&#038;h=465" width="620" height="465" /></a></p>
<p>In order to understand we will take a simple example a online retail bike selling we will have simple multidimentional data model with</p>
<p>Dimensions</p>
<ul>
<li><span style="line-height:13px;">dimgeog(loacation)</span></li>
<li>dimdate(Date)</li>
<li>dimproduct(Product)</li>
</ul>
<p>Fact</p>
<ul>
<li><span style="line-height:13px;">Sales</span></li>
</ul>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/oracle-cube.jpg"><img class="aligncenter size-full wp-image-1235" alt="oracle cube" src="http://sqljunkieshare.files.wordpress.com/2013/04/oracle-cube.jpg?w=620&#038;h=465" width="620" height="465" /></a></p>
<p>lets look at the Dimensional model at staging layer</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/data-models.jpg"><img class="aligncenter size-full wp-image-1236" alt="DATA MODELS" src="http://sqljunkieshare.files.wordpress.com/2013/04/data-models.jpg?w=620&#038;h=354" width="620" height="354" /></a></p>
<p>ROLLUP enables us to calculate multiple levels of subtotals across a specified group of dimensions(Hierarchy) , allowing us to create subtotals for different levels for hierarchy&#8217;s  in dimensions</p>
<p>ROLLUP creates subtotals for n+1 levels of subtotals where n is the number of grouping columns</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/simple-rollup2.jpg"><img class="aligncenter size-full wp-image-1240" alt="Simple Rollup" src="http://sqljunkieshare.files.wordpress.com/2013/04/simple-rollup2.jpg?w=620&#038;h=465" width="620" height="465" /></a></p>
<p>Simple ROLAP example</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples11.jpg"><img class="aligncenter size-full wp-image-1245" alt="rollup examples1" src="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples11.jpg?w=620&#038;h=436" width="620" height="436" /></a></p>
<p>How ROLLUP works</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples21.jpg"><img class="aligncenter size-full wp-image-1247" alt="rollup examples2" src="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples21.jpg?w=620&#038;h=465" width="620" height="465" /></a></p>
<p><strong>Understanding NULLS in ROLLUP , Readability and Querying, controlling grouping</strong></p>
<p>NULLS returned by GORUP BY extensions are not always always NULL, a NULL indicate that its a subtotal, in order to differentiate against a traditional NULL value</p>
<p>Oracle provides two functions GROUPING and GROUPING_ID</p>
<p>GROUPING(<strong>Column name</strong>)  will result 1 if a row is subtotaled on that given column name  and returns 0 if its null value or if row is not subtotaled</p>
<p>Using DECODE and GROUPING  functions we can rewrite above query for better readability</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples3.jpg"><img class="aligncenter size-full wp-image-1251" alt="rollup examples3" src="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples3.jpg?w=620&#038;h=459" width="620" height="459" /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples4.jpg"><img class="alignleft size-full wp-image-1252" alt="rollup examples4" src="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples4.jpg?w=620&#038;h=137" width="620" height="137" /></a></p>
<p>In order to build a complete cube we have to also need to include other dimensions as we discussed above geog, product, So we will add to these aggregation levels to our existing query</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples5.jpg"><img class="alignleft size-full wp-image-1253" alt="rollup examples5" src="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples5.jpg?w=620&#038;h=501" width="620" height="501" /></a></p>
<p>SELECT DECODE (grouping(dt.fiscalyear),1,&#8217;All years&#8217;,dt.fiscalyear) AS YEAR,<br />
DECODE (grouping(dt.fiscalquarter),1,&#8217;All Quarters&#8217; ,dt.fiscalquarter) AS quarter,</p>
<p>DECODE (grouping(dt.fiscalsemester),1,&#8217;All Semesters&#8217; ,dt.fiscalsemester) AS semister,</p>
<p>DECODE (grouping(dt.weeknumberofyear),1,&#8217;All Weeks&#8217; ,dt.weeknumberofyear) AS weeknmyr,<br />
DECODE (grouping(dg.englishcountryregionname),1,&#8217;All&#8217;,dg.englishcountryregionname) AS country,<br />
DECODE (grouping(dg.stateprovincename),1,&#8217;All State&#8221;s&#8217; ,dg.stateprovincename) AS state,<br />
DECODE (grouping(dg.city),1,&#8217;All City&#8221;s&#8217; ,dg.city) AS city,<br />
DECODE (grouping(dp.englishproductname ),1,&#8217;All Products&#8217;,dp.englishproductname) AS product,<br />
DECODE (grouping(prsubcat.englishproductsubcategoryname),1,&#8217;All Categories&#8217;<br />
, prsubcat.englishproductsubcategoryname) AS productsubcat,<br />
SUM( fs.salesamount) AS sales,<br />
GROUPING_ID(fiscalyear, dt.fiscalquarter,dt.fiscalsemester<br />
,dt.weeknumberofyear,englishcountryregionname,stateprovincename,city) AS GROUPID<br />
FROM factsales fs<br />
INNER JOIN dimdate dt<br />
ON fs.orderdatekey = dt.datekey<br />
INNER JOIN dimgeog dg<br />
ON dg.geographykey = fs.salesterritorykey<br />
INNER JOIN dimproduct dp<br />
ON dp.productkey = fs.productkey<br />
INNER JOIN dimproductsubcat prsubcat<br />
ON prsubcat.productsubcategorykey = dp.productsubcategorykey<br />
WHERE dp.englishproductname IN (&#8216;Road Tire Tube&#8217;)<br />
GROUP BY rollup(fiscalyear, dt.fiscalquarter,dt.fiscalsemester,dt.weeknumberofyear),<br />
ROLLUP( prsubcat.englishproductsubcategoryname,dp.englishproductname),<br />
ROLLUP(englishcountryregionname,stateprovincename,city);</p>
<p><strong>Now we have the query we have build a cube using Materialized views</strong></p>
<p><strong>First step is to build materialized views logs</strong></p>
<p><strong>Second build materialized view</strong></p>
<p>Script can be download from here</p>
<p><a title="scripts" href="https://www.dropbox.com/s/9eljxv6p91s8hkz/materialize%20views.sql" target="_blank">https://www.dropbox.com/s/9eljxv6p91s8hkz/materialize%20views.sql</a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/oralce-materialized-view.jpg"><img class="alignleft size-full wp-image-1255" alt="oralce materialized view" src="http://sqljunkieshare.files.wordpress.com/2013/04/oralce-materialized-view.jpg?w=620&#038;h=309" width="620" height="309" /></a></p>
<p>Now we have the ROLAP cube ready we can query it using native sql</p>
<p>Querying ROLAP cube can be leveraged using GROUPING_ID output</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-1.jpg"><img class="alignleft size-full wp-image-1256" alt="ROLAP cube 1" src="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-1.jpg?w=620&#038;h=315" width="620" height="315" /></a></p>
<p>Using grouping_id to query to ROLAP cube</p>
<p>Q) Retrieve total sales for all years  and country &#8220;Australia&#8221;, all city&#8217;s all states  for &#8220;Road Tire Tube&#8221;</p>
<p>To find group id</p>
<p>GROUPING_ID(FISCALYEAR, FISCALQUARTER, FISCALSEMESTER, WEEKNUMBER,COUNTRY, STATE, CITY,PRODUCTSUBCATEGORY, PRODUCTNAME)</p>
<p>1                                 1                                          1                                     1                    0                     1             1                         0                                               1</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-1.jpg"><img class="alignleft size-full wp-image-1261" alt="groupid query 1" src="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-1.jpg?w=620&#038;h=172" width="620" height="172" /></a></p>
<p>Q)  Total Sales in 2008 , for Australia  and state New South Wales all city&#8217;s</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-2.jpg"><img class="alignleft size-full wp-image-1262" alt="groupid query 2" src="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-2.jpg?w=620&#038;h=178" width="620" height="178" /></a></p>
<p><strong>GROUPING SETS </strong></p>
<p>Grouping sets allow selectively group in to sets and can also be used with ROLLUP to customize result</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets.jpg"><img class="alignleft size-full wp-image-1267" alt="grouping sets" src="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets.jpg?w=620&#038;h=575" width="620" height="575" /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets-equavalent.jpg"><img class="alignleft size-full wp-image-1268" alt="grouping sets equavalent" src="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets-equavalent.jpg?w=620&#038;h=575" width="620" height="575" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1234/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1234/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1234&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2013/04/25/creating-querying-tuning-hierarchical-rolap-cubes-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-over-view.jpg" medium="image">
			<media:title type="html">Rolap cube over view</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/oracle-cube.jpg" medium="image">
			<media:title type="html">oracle cube</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/data-models.jpg" medium="image">
			<media:title type="html">DATA MODELS</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/simple-rollup2.jpg" medium="image">
			<media:title type="html">Simple Rollup</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples11.jpg" medium="image">
			<media:title type="html">rollup examples1</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples21.jpg" medium="image">
			<media:title type="html">rollup examples2</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples3.jpg" medium="image">
			<media:title type="html">rollup examples3</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples4.jpg" medium="image">
			<media:title type="html">rollup examples4</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rollup-examples5.jpg" medium="image">
			<media:title type="html">rollup examples5</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/oralce-materialized-view.jpg" medium="image">
			<media:title type="html">oralce materialized view</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/rolap-cube-1.jpg" medium="image">
			<media:title type="html">ROLAP cube 1</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-1.jpg" medium="image">
			<media:title type="html">groupid query 1</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/groupid-query-2.jpg" medium="image">
			<media:title type="html">groupid query 2</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets.jpg" medium="image">
			<media:title type="html">grouping sets</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/04/grouping-sets-equavalent.jpg" medium="image">
			<media:title type="html">grouping sets equavalent</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get name of the day or day of the week in SQL Server ,Oracle and Mysql</title>
		<link>http://sqljunkieshare.com/2013/01/11/how-to-get-name-of-the-day-or-day-of-the-week-in-sql-server-oracle-and-mysql/</link>
		<comments>http://sqljunkieshare.com/2013/01/11/how-to-get-name-of-the-day-or-day-of-the-week-in-sql-server-oracle-and-mysql/#comments</comments>
		<pubDate>Fri, 11 Jan 2013 21:38:29 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[datename]]></category>
		<category><![CDATA[dayname]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[SQLSERVER 2012]]></category>
		<category><![CDATA[to_char]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1119</guid>
		<description><![CDATA[  Sql server has a date function  called DATENAME to get the name of the day or day of week       Oracle day name or day of week function   Mysql has a similar function called dayname() which is equivalent to datename in Microsoft SQL server   <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1119&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p> </p>
<p>Sql server has a date function  called DATENAME to get the name of the day or day of week</p>
<p> </p>
<p> </p>
<p><strong><a href="http://sqljunkieshare.files.wordpress.com/2013/01/date-name-sql-server1.jpg"><img class="size-full wp-image" id="i-1212" alt="Image" src="http://sqljunkieshare.files.wordpress.com/2013/01/date-name-sql-server1.jpg?w=459" /></a></strong></p>
<p> </p>
<p>Oracle day name or day of week function </p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/01/oracle-11-datename.jpg"><img class="size-full wp-image" id="i-1217" alt="Image" src="http://sqljunkieshare.files.wordpress.com/2013/01/oracle-11-datename.jpg?w=571" /></a></p>
<p> </p>
<p>Mysql has a similar function called dayname() which is equivalent to datename in Microsoft SQL server </p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2013/01/dayname-mysql.jpg"><img class="size-full wp-image" id="i-1229" alt="Image" src="http://sqljunkieshare.files.wordpress.com/2013/01/dayname-mysql.jpg?w=433" /></a></p>
<p> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1119&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2013/01/11/how-to-get-name-of-the-day-or-day-of-the-week-in-sql-server-oracle-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/01/date-name-sql-server1.jpg?w=459" medium="image">
			<media:title type="html">Image</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/01/oracle-11-datename.jpg?w=571" medium="image">
			<media:title type="html">Image</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2013/01/dayname-mysql.jpg?w=433" medium="image">
			<media:title type="html">Image</media:title>
		</media:content>
	</item>
		<item>
		<title>Column information of all the tables in a database (SqlServer2008 R2, MySQL, Oracle)</title>
		<link>http://sqljunkieshare.com/2012/11/13/column-information-of-all-the-tables-in-a-database-sqlserver2008-r2-mysql-oracle/</link>
		<comments>http://sqljunkieshare.com/2012/11/13/column-information-of-all-the-tables-in-a-database-sqlserver2008-r2-mysql-oracle/#comments</comments>
		<pubDate>Tue, 13 Nov 2012 21:42:43 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/2012/11/13/column-information-of-all-the-tables-in-a-database-sqlserver2008-r2-mysql-oracle/</guid>
		<description><![CDATA[  Different RDBMS provides system views with information about all the columns and their definitions in the database tables    SQLServer :  SYS.COLUMNS (Microsoft)                     INFORMATION_SCHEMA.COLUMNS (ANSI SQL) Oracle       : ALL_TAB_COLUMNS (ANSI SQL) My Sql       : INFORMATION_SCHEMA.COLUMNS (ANSI SQL)   Microsoft [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1118&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p> </p>
<p>Different RDBMS provides system views with information about all the columns and their definitions in the database tables </p>
<p> </p>
<p>SQLServer :  SYS.COLUMNS (Microsoft) </p>
<p>                   INFORMATION_SCHEMA.COLUMNS (ANSI SQL)</p>
<p>Oracle       : ALL_TAB_COLUMNS (ANSI SQL)</p>
<p>My Sql       : INFORMATION_SCHEMA.COLUMNS (ANSI SQL)</p>
<p> </p>
<p>Microsoft SQL server&#8217;s INFORMATION_SCHEMA.COLUMNS is equivalent to ALL_TAB_COLUMNS in oracle and INFORMATION_SCHEMA.COLUMNS in Mysql </p>
<p>ALL_TAB_COLUMNS in oracle  is equivalent to  Microsoft SQL server&#8217;s INFORMATION_SCHEMA.COLUMNS and INFORMATION_SCHEMA.COLUMNS in Mysql </p>
<p>INFORMATION_SCHEMA.COLUMNS in Mysql is equivalent to  ALL_TAB_COLUMNS in oracle  Microsoft SQL server&#8217;s INFORMATION_SCHEMA.COLUMNS and </p>
<p> </p>
<p>SQL Server </p>
<p>select *  from INFORMATION_SCHEMA.COLUMNS</p>
<p>Oracle</p>
<p>select * from ALL_TAB_COLUMNS</p>
<p> </p>
<p>My SQL </p>
<p>select *  from INFORMATION_SCHEMA.COLUMNS</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1118&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/11/13/column-information-of-all-the-tables-in-a-database-sqlserver2008-r2-mysql-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>
	</item>
		<item>
		<title>ISNULL , COALESCE in SQLSERVER, NVL in ORACLE, IFNULL() in MYSQL</title>
		<link>http://sqljunkieshare.com/2012/11/01/isnull-coalesce-in-sqlserver-nvl-in-oracle-ifnull-in-mysql/</link>
		<comments>http://sqljunkieshare.com/2012/11/01/isnull-coalesce-in-sqlserver-nvl-in-oracle-ifnull-in-mysql/#comments</comments>
		<pubDate>Thu, 01 Nov 2012 04:07:33 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[expression data]]></category>
		<category><![CDATA[input expressions]]></category>
		<category><![CDATA[return expression]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[type conversion]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1099</guid>
		<description><![CDATA[as a developer and writing querys you offtn encounter in a situation where you want to replace a NULL in your result every RDBMS has its own system function to handle this today we will go through these functions in detail We will start with SQL Server In sql Server we have to functions one [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1099&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>as a developer and writing querys you offtn encounter in a situation where you want to replace a NULL in your result every RDBMS has its own system function to handle this today we will go through these functions in detail</p>
<p>We will start with SQL Server</p>
<p>In sql Server we have to functions one is ISNULL and other COALESCE</p>
<p>ISNULL is a bult in TSQL function develped by Microsoft , it replaces null value with scpecified value</p>
<p>ISNULL(Check expression (Column/variable/value), replacement expression(Column/Variable/value))</p>
<p>The replacement expression should be impilictly convertable to check expression data type, SQl server implicitly converts</p>
<p>replacement value to the data type of Check expression and returns the value if check expression is null</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/10/isnull.jpg"><img class="alignleft size-full wp-image-1100" title="ISNULL" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/10/isnull.jpg?w=620"   /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/10/isnull1.jpg"><img class="alignleft size-full wp-image-1101" title="Isnull1" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/10/isnull1.jpg?w=620"   /></a></p>
<p>If we look at new column&#8217;s defnition it is a char datatype</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/10/isnull3.jpg"><img class="alignleft size-full wp-image-1102" title="isnull3" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/10/isnull3.jpg?w=620"   /></a></p>
<p>However if you switch our replacement expression with check expression it throws an error saying</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/10/explicit-conversion.jpg"><img class="alignleft size-full wp-image-1105" title="explicit conversion" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/10/explicit-conversion.jpg?w=620"   /></a></p>
<p>Msg 245, Level 16, State 1, Line 7</p>
<p>Conversion failed when converting the varchar value &#8216;a&#8217; to data type int.</p>
<p>Which is not possible according to sqlserver</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/10/ic1706171.gif"><img class="alignleft size-full wp-image-1104" title="IC170617" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/10/ic1706171.gif?w=620"   /></a></p>
<p>Sql server data type conversion chart</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms191530.aspx">http://msdn.microsoft.com/en-us/library/ms191530.aspx</a></p>
<p>It can only have two input expressions</p>
<p>Where as if we look at COALESCE it takes multiple expressions and returns first not null value</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/11/coalesce.jpg"><img class="alignleft size-full wp-image-1107" title="COALESCE" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/11/coalesce.jpg?w=620"   /></a></p>
<p>The one big dfference between ISNULL and COALESCE is the return data type,</p>
<p>When using ISNULL if check expression is evaluated to NULL and return expression is NOT NULL and is different data type that of check expression SQL Server implictly converts return expression to the data type of check expressions</p>
<p>Where as COALESCE well it returns the first not null value but the data type it returns depends on the SQL Server data type precedence</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms190309.aspx">http://msdn.microsoft.com/en-us/library/ms190309.aspx</a></p>
<p>Example:</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/11/colasece31.jpg"><img class="alignleft  wp-image-1111" title="Colasece3" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/11/colasece31.jpg?w=652&#038;h=422" height="422" width="652" /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/11/date-time-precedence-colaesce.jpg"><img class="alignleft  wp-image-1112" title="date time precedence colaesce" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/11/date-time-precedence-colaesce.jpg?w=652&#038;h=363" height="363" width="652" /></a></p>
<p>SQL server data type precedence</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms190309.aspx">http://msdn.microsoft.com/en-us/library/ms190309.aspx</a></p>
<p>about COALESCE</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms190349(v=sql.105).aspx">http://msdn.microsoft.com/en-us/library/ms190349(v=sql.105).aspx</a></p>
<p>NVL equavalent to ISNULL in SQLSERVER</p>
<p>NVL in ORACLE</p>
<p>NVL in Oracle works excatly as ISNULL in sql server</p>
<p>NVL (exp1 , exp2)</p>
<p>Exp1 is check expression and Exp2 is a replacement value</p>
<p>if Exp1 is NULL it returns Exp2 else it returns Exp1</p>
<p>Exp1 and Exp2 might not be same datatype just like in sql server but it should be implicitly convertble  to the datatype of Exp1</p>
<p>&nbsp;</p>
<p>But this implicit conversion is done in a smarter way when compared to isnull</p>
<ul>
<li>If <code>expr1</code> is character data, then Oracle Database converts <code>expr2</code> to the datatype of <code>expr1</code> before comparing them and returns <code>VARCHAR2</code> in the character set of <code>expr1</code>.</li>
<li>If <code>expr1</code> is numeric, then Oracle determines which argument has the highest numeric precedence, implicitly converts the other argument to that datatype, and returns that datatype.</li>
</ul>
<h3>Numeric Precedence <a id="sthref98"></a><a id="sthref99"></a></h3>
<p>Numeric precedence determines, for operations that support numeric datatypes, the datatype Oracle uses if the arguments to the operation have different datatypes. <code>BINARY_DOUBLE</code> has the highest numeric precedence, followed by <code>BINARY_FLOAT</code>, and finally by <code>NUMBER</code>. Therefore, in any operation on multiple numeric values:</p>
<ul>
<li>If any of the operands is <code>BINARY_DOUBLE</code>, then Oracle attempts to convert all the operands implicitly to <code>BINARY_DOUBLE</code> before performing the operation.</li>
<li>If none of the operands is <code>BINARY_DOUBLE</code> but any of the operands is <code>BINARY_FLOAT</code>, then Oracle attempts to convert all the operands implicitly to <code>BINARY_FLOAT</code> before performing the operation.</li>
<li>Otherwise, Oracle attempts to convert all the operands to <code>NUMBER</code> before performing the operation.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/11/nvl-oracle.jpg"><img class="alignleft size-full wp-image-1113" title="NVL Oracle" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/11/nvl-oracle.jpg?w=620"   /></a></p>
<p><a id="sthref330"></a><a id="g195937"></a>Table 2-10</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Implicit Type Conversion Matrix</p>
<p>&nbsp;</p>
<p><a id="sthref330"></a><a id="g195937"></a>Table 2-10 Implicit Type Conversion Matrix</p>
<table dir="ltr" title="Implicit Type Conversion Matrix" border="1">
<thead>
<tr>
<th id="r1c1-t41"></th>
<th id="r1c2-t41">CHAR</th>
<th id="r1c3-t41">VARCHAR2</th>
<th id="r1c4-t41">NCHAR</th>
<th id="r1c5-t41">NVARCHAR2</th>
<th id="r1c6-t41">DATE</th>
<th id="r1c7-t41">DATETIME/INTERVAL</th>
<th id="r1c8-t41">NUMBER</th>
<th id="r1c9-t41">BINARY_FLOAT</th>
<th id="r1c10-t41">BINARY_DOUBLE</th>
<th id="r1c11-t41">LONG</th>
<th id="r1c12-t41">RAW</th>
<th id="r1c13-t41">ROWID</th>
<th id="r1c14-t41">CLOB</th>
<th id="r1c15-t41">BLOB</th>
<th id="r1c16-t41">NCLOB</th>
</tr>
</thead>
<tbody>
<tr>
<td id="r2c1-t41" headers="r1c1-t41">CHAR</td>
<td headers="r2c1-t41 r1c2-t41">&#8211;</td>
<td headers="r2c1-t41 r1c3-t41">X</td>
<td headers="r2c1-t41 r1c4-t41">X</td>
<td headers="r2c1-t41 r1c5-t41">X</td>
<td headers="r2c1-t41 r1c6-t41">X</td>
<td headers="r2c1-t41 r1c7-t41">X</td>
<td headers="r2c1-t41 r1c8-t41">X</td>
<td headers="r2c1-t41 r1c9-t41">X</td>
<td headers="r2c1-t41 r1c10-t41">X</td>
<td headers="r2c1-t41 r1c11-t41">X</td>
<td headers="r2c1-t41 r1c12-t41">X</td>
<td headers="r2c1-t41 r1c13-t41">&#8211;</td>
<td headers="r2c1-t41 r1c14-t41">X</td>
<td headers="r2c1-t41 r1c15-t41">X</td>
<td headers="r2c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r3c1-t41" headers="r1c1-t41">VARCHAR2</td>
<td headers="r3c1-t41 r1c2-t41">X</td>
<td headers="r3c1-t41 r1c3-t41">&#8211;</td>
<td headers="r3c1-t41 r1c4-t41">X</td>
<td headers="r3c1-t41 r1c5-t41">X</td>
<td headers="r3c1-t41 r1c6-t41">X</td>
<td headers="r3c1-t41 r1c7-t41">X</td>
<td headers="r3c1-t41 r1c8-t41">X</td>
<td headers="r3c1-t41 r1c9-t41">X</td>
<td headers="r3c1-t41 r1c10-t41">X</td>
<td headers="r3c1-t41 r1c11-t41">X</td>
<td headers="r3c1-t41 r1c12-t41">X</td>
<td headers="r3c1-t41 r1c13-t41">X</td>
<td headers="r3c1-t41 r1c14-t41">X</td>
<td headers="r3c1-t41 r1c15-t41">&#8211;</td>
<td headers="r3c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r4c1-t41" headers="r1c1-t41">NCHAR</td>
<td headers="r4c1-t41 r1c2-t41">X</td>
<td headers="r4c1-t41 r1c3-t41">X</td>
<td headers="r4c1-t41 r1c4-t41">&#8211;</td>
<td headers="r4c1-t41 r1c5-t41">X</td>
<td headers="r4c1-t41 r1c6-t41">X</td>
<td headers="r4c1-t41 r1c7-t41">X</td>
<td headers="r4c1-t41 r1c8-t41">X</td>
<td headers="r4c1-t41 r1c9-t41">X</td>
<td headers="r4c1-t41 r1c10-t41">X</td>
<td headers="r4c1-t41 r1c11-t41">X</td>
<td headers="r4c1-t41 r1c12-t41">X</td>
<td headers="r4c1-t41 r1c13-t41">X</td>
<td headers="r4c1-t41 r1c14-t41">X</td>
<td headers="r4c1-t41 r1c15-t41">&#8211;</td>
<td headers="r4c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r5c1-t41" headers="r1c1-t41">NVARCHAR2</td>
<td headers="r5c1-t41 r1c2-t41">X</td>
<td headers="r5c1-t41 r1c3-t41">X</td>
<td headers="r5c1-t41 r1c4-t41">X</td>
<td headers="r5c1-t41 r1c5-t41">&#8211;</td>
<td headers="r5c1-t41 r1c6-t41">X</td>
<td headers="r5c1-t41 r1c7-t41">X</td>
<td headers="r5c1-t41 r1c8-t41">X</td>
<td headers="r5c1-t41 r1c9-t41">X</td>
<td headers="r5c1-t41 r1c10-t41">X</td>
<td headers="r5c1-t41 r1c11-t41">X</td>
<td headers="r5c1-t41 r1c12-t41">X</td>
<td headers="r5c1-t41 r1c13-t41">X</td>
<td headers="r5c1-t41 r1c14-t41">X</td>
<td headers="r5c1-t41 r1c15-t41">&#8211;</td>
<td headers="r5c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r6c1-t41" headers="r1c1-t41">DATE</td>
<td headers="r6c1-t41 r1c2-t41">X</td>
<td headers="r6c1-t41 r1c3-t41">X</td>
<td headers="r6c1-t41 r1c4-t41">X</td>
<td headers="r6c1-t41 r1c5-t41">X</td>
<td headers="r6c1-t41 r1c6-t41">&#8211;</td>
<td headers="r6c1-t41 r1c7-t41">&#8211;</td>
<td headers="r6c1-t41 r1c8-t41">&#8211;</td>
<td headers="r6c1-t41 r1c9-t41">&#8211;</td>
<td headers="r6c1-t41 r1c10-t41">&#8211;</td>
<td headers="r6c1-t41 r1c11-t41">&#8211;</td>
<td headers="r6c1-t41 r1c12-t41">&#8211;</td>
<td headers="r6c1-t41 r1c13-t41">&#8211;</td>
<td headers="r6c1-t41 r1c14-t41">&#8211;</td>
<td headers="r6c1-t41 r1c15-t41">&#8211;</td>
<td headers="r6c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r7c1-t41" headers="r1c1-t41">DATETIME/ INTERVAL</td>
<td headers="r7c1-t41 r1c2-t41">X</td>
<td headers="r7c1-t41 r1c3-t41">X</td>
<td headers="r7c1-t41 r1c4-t41">X</td>
<td headers="r7c1-t41 r1c5-t41">X</td>
<td headers="r7c1-t41 r1c6-t41">&#8211;</td>
<td headers="r7c1-t41 r1c7-t41">&#8211;</td>
<td headers="r7c1-t41 r1c8-t41">&#8211;</td>
<td headers="r7c1-t41 r1c9-t41">&#8211;</td>
<td headers="r7c1-t41 r1c10-t41">&#8211;</td>
<td headers="r7c1-t41 r1c11-t41">X</td>
<td headers="r7c1-t41 r1c12-t41">&#8211;</td>
<td headers="r7c1-t41 r1c13-t41">&#8211;</td>
<td headers="r7c1-t41 r1c14-t41">&#8211;</td>
<td headers="r7c1-t41 r1c15-t41">&#8211;</td>
<td headers="r7c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r8c1-t41" headers="r1c1-t41">NUMBER</td>
<td headers="r8c1-t41 r1c2-t41">X</td>
<td headers="r8c1-t41 r1c3-t41">X</td>
<td headers="r8c1-t41 r1c4-t41">X</td>
<td headers="r8c1-t41 r1c5-t41">X</td>
<td headers="r8c1-t41 r1c6-t41">&#8211;</td>
<td headers="r8c1-t41 r1c7-t41">&#8211;</td>
<td headers="r8c1-t41 r1c8-t41">&#8211;</td>
<td headers="r8c1-t41 r1c9-t41">X</td>
<td headers="r8c1-t41 r1c10-t41">X</td>
<td headers="r8c1-t41 r1c11-t41">&#8211;</td>
<td headers="r8c1-t41 r1c12-t41">&#8211;</td>
<td headers="r8c1-t41 r1c13-t41">&#8211;</td>
<td headers="r8c1-t41 r1c14-t41">&#8211;</td>
<td headers="r8c1-t41 r1c15-t41">&#8211;</td>
<td headers="r8c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r9c1-t41" headers="r1c1-t41">BINARY_FLOAT</td>
<td headers="r9c1-t41 r1c2-t41">X</td>
<td headers="r9c1-t41 r1c3-t41">X</td>
<td headers="r9c1-t41 r1c4-t41">X</td>
<td headers="r9c1-t41 r1c5-t41">X</td>
<td headers="r9c1-t41 r1c6-t41">&#8211;</td>
<td headers="r9c1-t41 r1c7-t41">&#8211;</td>
<td headers="r9c1-t41 r1c8-t41">X</td>
<td headers="r9c1-t41 r1c9-t41">&#8211;</td>
<td headers="r9c1-t41 r1c10-t41">X</td>
<td headers="r9c1-t41 r1c11-t41">&#8211;</td>
<td headers="r9c1-t41 r1c12-t41">&#8211;</td>
<td headers="r9c1-t41 r1c13-t41">&#8211;</td>
<td headers="r9c1-t41 r1c14-t41">&#8211;</td>
<td headers="r9c1-t41 r1c15-t41">&#8211;</td>
<td headers="r9c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r10c1-t41" headers="r1c1-t41">BINARY_DOUBLE</td>
<td headers="r10c1-t41 r1c2-t41">X</td>
<td headers="r10c1-t41 r1c3-t41">X</td>
<td headers="r10c1-t41 r1c4-t41">X</td>
<td headers="r10c1-t41 r1c5-t41">X</td>
<td headers="r10c1-t41 r1c6-t41">&#8211;</td>
<td headers="r10c1-t41 r1c7-t41">&#8211;</td>
<td headers="r10c1-t41 r1c8-t41">X</td>
<td headers="r10c1-t41 r1c9-t41">X</td>
<td headers="r10c1-t41 r1c10-t41">&#8211;</td>
<td headers="r10c1-t41 r1c11-t41">&#8211;</td>
<td headers="r10c1-t41 r1c12-t41">&#8211;</td>
<td headers="r10c1-t41 r1c13-t41">&#8211;</td>
<td headers="r10c1-t41 r1c14-t41">&#8211;</td>
<td headers="r10c1-t41 r1c15-t41">&#8211;</td>
<td headers="r10c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r11c1-t41" headers="r1c1-t41">LONG</td>
<td headers="r11c1-t41 r1c2-t41">X</td>
<td headers="r11c1-t41 r1c3-t41">X</td>
<td headers="r11c1-t41 r1c4-t41">X</td>
<td headers="r11c1-t41 r1c5-t41">X</td>
<td headers="r11c1-t41 r1c6-t41">&#8211;</td>
<td headers="r11c1-t41 r1c7-t41">X</td>
<td headers="r11c1-t41 r1c8-t41">&#8211;</td>
<td headers="r11c1-t41 r1c9-t41">&#8211;</td>
<td headers="r11c1-t41 r1c10-t41">&#8211;</td>
<td headers="r11c1-t41 r1c11-t41">&#8211;</td>
<td headers="r11c1-t41 r1c12-t41">X</td>
<td headers="r11c1-t41 r1c13-t41">&#8211;</td>
<td headers="r11c1-t41 r1c14-t41">X</td>
<td headers="r11c1-t41 r1c15-t41">&#8211;</td>
<td headers="r11c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r12c1-t41" headers="r1c1-t41">RAW</td>
<td headers="r12c1-t41 r1c2-t41">X</td>
<td headers="r12c1-t41 r1c3-t41">X</td>
<td headers="r12c1-t41 r1c4-t41">X</td>
<td headers="r12c1-t41 r1c5-t41">X</td>
<td headers="r12c1-t41 r1c6-t41">&#8211;</td>
<td headers="r12c1-t41 r1c7-t41">&#8211;</td>
<td headers="r12c1-t41 r1c8-t41">&#8211;</td>
<td headers="r12c1-t41 r1c9-t41">&#8211;</td>
<td headers="r12c1-t41 r1c10-t41">&#8211;</td>
<td headers="r12c1-t41 r1c11-t41">X</td>
<td headers="r12c1-t41 r1c12-t41">&#8211;</td>
<td headers="r12c1-t41 r1c13-t41">&#8211;</td>
<td headers="r12c1-t41 r1c14-t41">&#8211;</td>
<td headers="r12c1-t41 r1c15-t41">X</td>
<td headers="r12c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r13c1-t41" headers="r1c1-t41">ROWID</td>
<td headers="r13c1-t41 r1c2-t41">&#8211;</td>
<td headers="r13c1-t41 r1c3-t41">X</td>
<td headers="r13c1-t41 r1c4-t41">X</td>
<td headers="r13c1-t41 r1c5-t41">X</td>
<td headers="r13c1-t41 r1c6-t41">&#8211;</td>
<td headers="r13c1-t41 r1c7-t41">&#8211;</td>
<td headers="r13c1-t41 r1c8-t41">&#8211;</td>
<td headers="r13c1-t41 r1c9-t41">&#8211;</td>
<td headers="r13c1-t41 r1c10-t41">&#8211;</td>
<td headers="r13c1-t41 r1c11-t41">&#8211;</td>
<td headers="r13c1-t41 r1c12-t41">&#8211;</td>
<td headers="r13c1-t41 r1c13-t41">&#8211;</td>
<td headers="r13c1-t41 r1c14-t41">&#8211;</td>
<td headers="r13c1-t41 r1c15-t41">&#8211;</td>
<td headers="r13c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r14c1-t41" headers="r1c1-t41">CLOB</td>
<td headers="r14c1-t41 r1c2-t41">X</td>
<td headers="r14c1-t41 r1c3-t41">X</td>
<td headers="r14c1-t41 r1c4-t41">X</td>
<td headers="r14c1-t41 r1c5-t41">X</td>
<td headers="r14c1-t41 r1c6-t41">&#8211;</td>
<td headers="r14c1-t41 r1c7-t41">&#8211;</td>
<td headers="r14c1-t41 r1c8-t41">&#8211;</td>
<td headers="r14c1-t41 r1c9-t41">&#8211;</td>
<td headers="r14c1-t41 r1c10-t41">&#8211;</td>
<td headers="r14c1-t41 r1c11-t41">X</td>
<td headers="r14c1-t41 r1c12-t41">&#8211;</td>
<td headers="r14c1-t41 r1c13-t41">&#8211;</td>
<td headers="r14c1-t41 r1c14-t41">&#8211;</td>
<td headers="r14c1-t41 r1c15-t41">&#8211;</td>
<td headers="r14c1-t41 r1c16-t41">X</td>
</tr>
<tr>
<td id="r15c1-t41" headers="r1c1-t41">BLOB</td>
<td headers="r15c1-t41 r1c2-t41">&#8211;</td>
<td headers="r15c1-t41 r1c3-t41">&#8211;</td>
<td headers="r15c1-t41 r1c4-t41">&#8211;</td>
<td headers="r15c1-t41 r1c5-t41">&#8211;</td>
<td headers="r15c1-t41 r1c6-t41">&#8211;</td>
<td headers="r15c1-t41 r1c7-t41">&#8211;</td>
<td headers="r15c1-t41 r1c8-t41">&#8211;</td>
<td headers="r15c1-t41 r1c9-t41">&#8211;</td>
<td headers="r15c1-t41 r1c10-t41">&#8211;</td>
<td headers="r15c1-t41 r1c11-t41">&#8211;</td>
<td headers="r15c1-t41 r1c12-t41">X</td>
<td headers="r15c1-t41 r1c13-t41">&#8211;</td>
<td headers="r15c1-t41 r1c14-t41">&#8211;</td>
<td headers="r15c1-t41 r1c15-t41">&#8211;</td>
<td headers="r15c1-t41 r1c16-t41">&#8211;</td>
</tr>
<tr>
<td id="r16c1-t41" headers="r1c1-t41">NCLOB</td>
<td headers="r16c1-t41 r1c2-t41">X</td>
<td headers="r16c1-t41 r1c3-t41">X</td>
<td headers="r16c1-t41 r1c4-t41">X</td>
<td headers="r16c1-t41 r1c5-t41">X</td>
<td headers="r16c1-t41 r1c6-t41">&#8211;</td>
<td headers="r16c1-t41 r1c7-t41">&#8211;</td>
<td headers="r16c1-t41 r1c8-t41">&#8211;</td>
<td headers="r16c1-t41 r1c9-t41">&#8211;</td>
<td headers="r16c1-t41 r1c10-t41">&#8211;</td>
<td headers="r16c1-t41 r1c11-t41">X</td>
<td headers="r16c1-t41 r1c12-t41">&#8211;</td>
<td headers="r16c1-t41 r1c13-t41">&#8211;</td>
<td headers="r16c1-t41 r1c14-t41">X</td>
<td headers="r16c1-t41 r1c15-t41">&#8211;</td>
<td headers="r16c1-t41 r1c16-t41">&#8211;</td>
</tr>
</tbody>
</table>
<p>Oracle Implicit Conversion Matrix</p>
<p>IFNULLI() in MY SQL</p>
<p>&nbsp;</p>
<p>IFNULL() is equavalent to NVL() in oracle and ISNULL() in Microsoft Sql server</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/11/ifnulmysql.jpg"><img class="alignleft size-full wp-image-1115" title="ifnulmysql" alt="" src="http://sqljunkieshare.files.wordpress.com/2012/11/ifnulmysql.jpg?w=620"   /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1099/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1099/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1099&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/11/01/isnull-coalesce-in-sqlserver-nvl-in-oracle-ifnull-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/10/isnull.jpg" medium="image">
			<media:title type="html">ISNULL</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/10/isnull1.jpg" medium="image">
			<media:title type="html">Isnull1</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/10/isnull3.jpg" medium="image">
			<media:title type="html">isnull3</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/10/explicit-conversion.jpg" medium="image">
			<media:title type="html">explicit conversion</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/10/ic1706171.gif" medium="image">
			<media:title type="html">IC170617</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/11/coalesce.jpg" medium="image">
			<media:title type="html">COALESCE</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/11/colasece31.jpg" medium="image">
			<media:title type="html">Colasece3</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/11/date-time-precedence-colaesce.jpg" medium="image">
			<media:title type="html">date time precedence colaesce</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/11/nvl-oracle.jpg" medium="image">
			<media:title type="html">NVL Oracle</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/11/ifnulmysql.jpg" medium="image">
			<media:title type="html">ifnulmysql</media:title>
		</media:content>
	</item>
		<item>
		<title>Data Cube: A Relational Aggregation Operator : Microsoft research paper</title>
		<link>http://sqljunkieshare.com/2012/08/24/data-cube-a-relational-aggregation-operator-microsoft-research-paper/</link>
		<comments>http://sqljunkieshare.com/2012/08/24/data-cube-a-relational-aggregation-operator-microsoft-research-paper/#comments</comments>
		<pubDate>Fri, 24 Aug 2012 15:08:03 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Database Design - SQL server 2008, 2008R2 & 2012]]></category>
		<category><![CDATA[enterprise-it]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[it-security]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1095</guid>
		<description><![CDATA[Very nice article on group by clause , how it works and what are its limitations and how can we overcome with a CUBE operator Data analysis applications typically aggregate data across many dimensions looking for unusual patterns. The SQL aggregate functions and the GROUP BY operator produce zero-dimensional or 1-dimensional answers. Applications need the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1095&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Very nice article on group by clause , how it works and what are its limitations and how can we overcome with a CUBE operator</p>
<p>Data analysis applications typically aggregate data across many dimensions looking for unusual patterns. The SQL aggregate functions and the GROUP BY operator produce zero-dimensional or 1-dimensional answers. Applications need the N-dimensional generalization of these operators. This paper defines that operator, called the data cube, or simply cube. The cube operator generalizes the histogram, cross-tabulation, drill-down, and sub-total constructs found in most report writers. The cube treats each of the N aggregation attributes as a dimension of N-space. The aggregate of a particular set of attribute values is a point in this space. The set of points form an N-dimensional cube. Super-aggregates are computed by aggregating the N-cube to lower dimensional spaces. Aggregation points are represented by an &#8220;infinite value&#8221;, ALL. For example, the point would represent the global sum of all items. Each ALL value actually represents the set of values contributing to that aggregation</p>
<p>Source :</p>
<p><a href="http://research.microsoft.com/apps/pubs/default.aspx?id=69578">http://research.microsoft.com/apps/pubs/default.aspx?id=69578</a></p>
<p>&nbsp;</p>
<p>Download PDF file by clicking below link</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/08/microsoft-cube-research.pdf">MIcrosoft cube research</a></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1095/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1095/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1095&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/08/24/data-cube-a-relational-aggregation-operator-microsoft-research-paper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>
	</item>
		<item>
		<title>How to summarize your data using ROLLUP and CUBE in TSQL</title>
		<link>http://sqljunkieshare.com/2012/08/16/how-to-summarize-your-data-using-rollup-and-cube-in-tsql/</link>
		<comments>http://sqljunkieshare.com/2012/08/16/how-to-summarize-your-data-using-rollup-and-cube-in-tsql/#comments</comments>
		<pubDate>Thu, 16 Aug 2012 03:09:11 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Database Design - SQL server 2008, 2008R2 & 2012]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1086</guid>
		<description><![CDATA[We all know when reporiting any financial or sales information adding sub totals and grand totals to report makes it more effective but most offten develop0rs dont realize TSQL provides a effective way in doing this is using rollup and cube operators in group by clause. So for this demo I am using Adventure works [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1086&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>We all know when reporiting any financial or sales information adding sub totals and grand totals to report makes it more effective but most offten develop0rs dont realize TSQL provides a effective way in doing this is using rollup and cube operators in group by clause.</p>
<p>So for this demo I am using Adventure works 2008 OLTP sample database</p>
<p>Three tables</p>
<ol>
<li>Production.Product</li>
<li>Production<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategory</span></li>
<li>Production<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategory</span></li>
</ol>
<p>here is a simple querying joining three tables and grouping by product category and subcategory</p>
<p>select</p>
<p>pc<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategoryID</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span></p>
<p>s<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategoryID</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span></p>
<p>AVG<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="font-size:small;">ListPrice</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">)</span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">as</span></span><span style="font-size:small;"> Avglistprice</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span></p>
<p>MAX <span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="font-size:small;">ListPrice</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">)</span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">as</span></span><span style="font-size:small;"> MAxlistprice</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span></p>
<p>MAX<span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="font-size:small;">StandardCost</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">)</span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">as</span></span><span style="font-size:small;"> Maxstandardcost</span></p>
<p>from <span style="font-size:small;">Production</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">Product p </span></p>
<p>inner <span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">join</span></span><span style="font-size:small;"> Production</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategory s </span></p>
<p>on  <span style="font-size:small;">p</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategoryID </span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="font-size:small;"> s</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategoryID</span></p>
<p>inner <span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">join</span></span><span style="font-size:small;"> Production</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategory pc </span></p>
<p>on  <span style="font-size:small;">pc</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategoryID </span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="font-size:small;"> s</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategoryID</span></p>
<p>group <span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">by</span></span><span style="font-size:small;"> pc</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategoryID</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span><span style="font-size:small;">s</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategoryID</span></p>
<p>SAMPLE RESULT</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/08/sample-result.jpg"><img class="alignleft size-full wp-image-1087" title="sample result" src="http://sqljunkieshare.files.wordpress.com/2012/08/sample-result.jpg?w=620" alt=""   /></a></p>
<p>You can see we are missing some things in the above result i.e  subtotals and grand totals</p>
<p>change group by cluase to include rollup operator like this</p>
<p>group <span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">by </span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">ROLLUP</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="font-size:small;">pc</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductCategoryID</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span><span style="font-size:small;">s</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">.</span></span><span style="font-size:small;">ProductSubcategoryID</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">)</span></span></p>
<p>trying running it with out errors</p>
<p>Result looks like this</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/08/result.jpg"><img class="alignleft size-full wp-image-1088" title="result" src="http://sqljunkieshare.files.wordpress.com/2012/08/result.jpg?w=620" alt=""   /></a></p>
<p>CUBE is used as same way but it gives us a little different result , CUBE summarizes all the combinations of  columns in group by clause and it also gives us grandtotal which does not make sense for above example because each sub category exists once in each category.</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/08/cube.jpg"><img class="alignleft size-full wp-image-1089" title="cube" src="http://sqljunkieshare.files.wordpress.com/2012/08/cube.jpg?w=620" alt=""   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1086/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1086&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/08/16/how-to-summarize-your-data-using-rollup-and-cube-in-tsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/08/sample-result.jpg" medium="image">
			<media:title type="html">sample result</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/08/result.jpg" medium="image">
			<media:title type="html">result</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/08/cube.jpg" medium="image">
			<media:title type="html">cube</media:title>
		</media:content>
	</item>
		<item>
		<title>you will &#8216;%_[^LIKE]%&#8217; like</title>
		<link>http://sqljunkieshare.com/2012/07/30/you-will-_like-like/</link>
		<comments>http://sqljunkieshare.com/2012/07/30/you-will-_like-like/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 03:51:29 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Database Design - SQL server 2008, 2008R2 & 2012]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1072</guid>
		<description><![CDATA[Like cluase allows you to match a character string found in a column to a specified pattern in the where clause lets take an example to better understand its wild cards How to use like in where clause DECLARE@TTABLE (charcvarchar(20)) INSERTINTO@T(charc) VALUES(&#8216;Cat&#8217;) ,(&#8216;hat&#8217;) ,(&#8216;that&#8217;) ,(&#8216;at&#8217;) ,(&#8216;c&#8217;) ,(&#8216;a&#8217;) &#160; &#160; Percent % : Underscore _ : [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1072&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Like cluase allows you to match a character string found in a column to a specified pattern in the where clause</p>
<p>lets take an example to better understand its wild cards</p>
<p>How to use like in where clause</p>
<p><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">DECLARE</span></span></span><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;">@T</span></span></span><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">TABLE </span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">(</span></span></span><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;">charc</span></span></span><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">varchar</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">(</span></span></span><span style="font-family:Consolas;font-size:small;"><span style="font-family:Consolas;font-size:small;">20</span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">))</span></span></span></p>
<p><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">INSERT</span></span></span><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">INTO</span></span></span><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;">@T</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">(</span></span></span><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;"><span style="color:#008080;font-family:Consolas;font-size:small;">charc</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;"><span style="color:#0000ff;font-family:Consolas;font-size:small;">VALUES</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;Cat&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">,(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;hat&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">,(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;that&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">,(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;at&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">,(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;c&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">,(</span></span></span><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;"><span style="color:#ff0000;font-family:Consolas;font-size:small;">&#8216;a&#8217;</span></span></span><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;"><span style="color:#808080;font-family:Consolas;font-size:small;">)</span></span></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Percent % :</strong></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like1.jpg"><img title="like1" src="http://sqljunkieshare.files.wordpress.com/2012/07/like1.jpg?w=472&#038;h=318" alt="" width="472" height="318" /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like2.jpg"><img title="like2" src="http://sqljunkieshare.files.wordpress.com/2012/07/like2.jpg?w=463&#038;h=296" alt="" width="463" height="296" /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like3.jpg"><img title="like3" src="http://sqljunkieshare.files.wordpress.com/2012/07/like3.jpg?w=478&#038;h=319" alt="" width="478" height="319" /></a></p>
<p><strong>Underscore _ :</strong></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like41.jpg"><img title="like4" src="http://sqljunkieshare.files.wordpress.com/2012/07/like41.jpg?w=501&#038;h=378" alt="" width="501" height="378" /></a></p>
<p><strong>Square Brackets [] :</strong></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like51.jpg"><img title="like5" src="http://sqljunkieshare.files.wordpress.com/2012/07/like51.jpg?w=500&#038;h=348" alt="" width="500" height="348" /></a></p>
<p><strong>Caret:</strong></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like.jpg"><img class="alignleft size-full wp-image-1073" title="like" src="http://sqljunkieshare.files.wordpress.com/2012/07/like.jpg?w=620" alt=""   /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/like6.jpg"><img class="alignleft size-full wp-image-1081" title="like6" src="http://sqljunkieshare.files.wordpress.com/2012/07/like6.jpg?w=620" alt=""   /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1072/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1072/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1072&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/07/30/you-will-_like-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like1.jpg" medium="image">
			<media:title type="html">like1</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like2.jpg" medium="image">
			<media:title type="html">like2</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like3.jpg" medium="image">
			<media:title type="html">like3</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like41.jpg" medium="image">
			<media:title type="html">like4</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like51.jpg" medium="image">
			<media:title type="html">like5</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like.jpg" medium="image">
			<media:title type="html">like</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/like6.jpg" medium="image">
			<media:title type="html">like6</media:title>
		</media:content>
	</item>
		<item>
		<title>watch out for nulls .. know ur environment</title>
		<link>http://sqljunkieshare.com/2012/07/30/watch-out-for-nulls-know-ur-environment/</link>
		<comments>http://sqljunkieshare.com/2012/07/30/watch-out-for-nulls-know-ur-environment/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 02:53:11 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Database Design - SQL server 2008, 2008R2 & 2012]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1064</guid>
		<description><![CDATA[ANSI_NULLS is a user option in sql server , which is like a env variable when a user establishes a connection to sqlserver ANSI_NULLS specifies the behavior of nulls when using equality and inequality comparision against null &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1064&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>ANSI_NULLS is a user option in sql server , which is like a env variable when a user establishes a connection to sqlserver</p>
<p>ANSI_NULLS specifies the behavior of nulls when using equality and inequality comparision against null</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/nulls.jpg"><img class="alignleft size-full wp-image-1066" title="nulls" src="http://sqljunkieshare.files.wordpress.com/2012/07/nulls.jpg?w=620" alt=""   /></a></p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/null2.jpg"><img class="alignleft size-full wp-image-1067" title="null2" src="http://sqljunkieshare.files.wordpress.com/2012/07/null2.jpg?w=620" alt=""   /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>as ANSI_NULLS is turned on , any query having comparing nulls will result in unknown result</p>
<p>Once we turn it off we will be able to query</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://sqljunkieshare.files.wordpress.com/2012/07/null3.jpg"><img class="alignleft size-full wp-image-1068" title="NUll3" src="http://sqljunkieshare.files.wordpress.com/2012/07/null3.jpg?w=620" alt=""   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1064/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1064/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1064&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/07/30/watch-out-for-nulls-know-ur-environment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/nulls.jpg" medium="image">
			<media:title type="html">nulls</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/null2.jpg" medium="image">
			<media:title type="html">null2</media:title>
		</media:content>

		<media:content url="http://sqljunkieshare.files.wordpress.com/2012/07/null3.jpg" medium="image">
			<media:title type="html">NUll3</media:title>
		</media:content>
	</item>
		<item>
		<title>Genrating Non-Uniform random numbers between a range using TSQL</title>
		<link>http://sqljunkieshare.com/2012/07/03/genrating-non-uniform-random-numbers-between-a-range-using-tsql/</link>
		<comments>http://sqljunkieshare.com/2012/07/03/genrating-non-uniform-random-numbers-between-a-range-using-tsql/#comments</comments>
		<pubDate>Tue, 03 Jul 2012 13:34:59 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1058</guid>
		<description><![CDATA[&#160; &#8211;Below script will generates a random number between 1000 and 2000 for each execution declare @min int= 1000 declare @max int= 2000 declare @random int=(selectconvert(int,RAND()* @min)) set @random = @max-@random+1  select @random<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1058&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&#8211;Below script will generates a random number between 1000 and 2000 for each execution</p>
<p>declare <span style="font-size:small;">@min </span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">int</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="font-size:small;"> 1000</span></p>
<p>declare <span style="font-size:small;">@max </span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">int</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="font-size:small;"> 2000</span></p>
<p>declare <span style="font-size:small;">@random </span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">int</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">select</span></span><span style="color:#ff00ff;font-size:small;"><span style="color:#ff00ff;font-size:small;">convert</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">(</span></span><span style="color:#0000ff;font-size:small;"><span style="color:#0000ff;font-size:small;">int</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">,</span></span><span style="color:#ff00ff;font-size:small;"><span style="color:#ff00ff;font-size:small;">RAND</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">()</span></span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">*</span></span><span style="font-size:small;"> @min</span><span style="color:#808080;font-size:small;">))</span></p>
<p>set <span style="font-size:small;">@random </span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">=</span></span><span style="font-size:small;"> @max</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">-</span></span><span style="font-size:small;">@random</span><span style="color:#808080;font-size:small;"><span style="color:#808080;font-size:small;">+</span></span><span style="font-size:small;">1</span></p>
<p> select <span style="font-size:small;">@random</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1058/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1058/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1058&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/07/03/genrating-non-uniform-random-numbers-between-a-range-using-tsql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>
	</item>
		<item>
		<title>How to generate a simple calender table for a year using recursive CTE</title>
		<link>http://sqljunkieshare.com/2012/06/27/how-to-generate-a-simple-calender-table-using-recursive-cte/</link>
		<comments>http://sqljunkieshare.com/2012/06/27/how-to-generate-a-simple-calender-table-using-recursive-cte/#comments</comments>
		<pubDate>Wed, 27 Jun 2012 12:38:38 +0000</pubDate>
		<dc:creator>akhil393</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sqljunkieshare.com/?p=1054</guid>
		<description><![CDATA[;WITH Dates AS ( SELECT CAST(&#8217;2012-01-01&#8242; AS DATE) [DateValue] UNION ALL SELECT DATEADD(D, 1, [DateValue]) FROM Dates WHERE [DateValue] &#60; &#8217;2012-12-31&#8242; ) SELECT * FROM Dates OPTION (MAXRECURSION 367)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1054&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>;WITH Dates AS<br />
(<br />
SELECT CAST(&#8217;2012-01-01&#8242; AS DATE) [DateValue]<br />
UNION ALL<br />
SELECT DATEADD(D, 1, [DateValue]) FROM Dates<br />
WHERE [DateValue] &lt; &#8217;2012-12-31&#8242;<br />
)</p>
<p>SELECT * FROM Dates<br />
OPTION (MAXRECURSION 367)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqljunkieshare.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqljunkieshare.wordpress.com/1054/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqljunkieshare.com&#038;blog=26794645&#038;post=1054&#038;subd=sqljunkieshare&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqljunkieshare.com/2012/06/27/how-to-generate-a-simple-calender-table-using-recursive-cte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/170362db71c7f289c82e6f5cc380180f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">akhil393</media:title>
		</media:content>
	</item>
	</channel>
</rss>
