<?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>Dot Net Learning Zone Blog &#187; SQL Question</title>
	<atom:link href="http://dotnethacker.wordpress.com/category/sql-question/feed/" rel="self" type="application/rss+xml" />
	<link>http://dotnethacker.wordpress.com</link>
	<description>A blog about to learn Dot Net</description>
	<lastBuildDate>Tue, 10 Mar 2009 10:18:24 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='dotnethacker.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/bd73af5c5d7f80b4297a4a7888c59e8e?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Dot Net Learning Zone Blog &#187; SQL Question</title>
		<link>http://dotnethacker.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dotnethacker.wordpress.com/osd.xml" title="Dot Net Learning Zone Blog" />
		<item>
		<title>How to get value using SP_EXECUTESQL</title>
		<link>http://dotnethacker.wordpress.com/2009/03/10/how-to-get-value-using-sp_executesql/</link>
		<comments>http://dotnethacker.wordpress.com/2009/03/10/how-to-get-value-using-sp_executesql/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 08:09:46 +0000</pubDate>
		<dc:creator>Rajesh</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Question]]></category>

		<guid isPermaLink="false">http://dotnethacker.wordpress.com/?p=46</guid>
		<description><![CDATA[DECLARE @Name varchar(50)
DECLARE @Query nvarchar(200)
DECLARE @ParmDefinition NVARCHAR(500)
SET @Query =&#8217;Select  @Name=CompanyName  from CompanyDetail&#8217;
SET @ParmDefinition = N&#8217;@Name varchar(50) OUTPUT&#8217;
EXEC SP_EXECUTESQL @Query,@ParmDefinition,@Name=@Name OUTPUT
SELECT @Name
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=46&subd=dotnethacker&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>DECLARE @Name varchar(50)<br />
DECLARE @Query nvarchar(200)<br />
DECLARE @ParmDefinition NVARCHAR(500)<br />
SET @Query =&#8217;Select  @Name=CompanyName  from CompanyDetail&#8217;<br />
SET @ParmDefinition = N&#8217;@Name varchar(50) OUTPUT&#8217;<br />
EXEC SP_EXECUTESQL @Query,@ParmDefinition,@Name=@Name OUTPUT<br />
SELECT @Name</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotnethacker.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotnethacker.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotnethacker.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotnethacker.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotnethacker.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotnethacker.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotnethacker.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotnethacker.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotnethacker.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotnethacker.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=46&subd=dotnethacker&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotnethacker.wordpress.com/2009/03/10/how-to-get-value-using-sp_executesql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a4569660033e084ca73354bbd3c0719?s=96&#38;d=identicon" medium="image">
			<media:title type="html">rajesh20k</media:title>
		</media:content>
	</item>
		<item>
		<title>Find duplicate row in table in SQL</title>
		<link>http://dotnethacker.wordpress.com/2008/05/27/find-duplicate-row-in-table-in-sql/</link>
		<comments>http://dotnethacker.wordpress.com/2008/05/27/find-duplicate-row-in-table-in-sql/#comments</comments>
		<pubDate>Tue, 27 May 2008 12:12:15 +0000</pubDate>
		<dc:creator>Rajesh</dc:creator>
				<category><![CDATA[SQL Question]]></category>

		<guid isPermaLink="false">http://dotnethacker.wordpress.com/?p=20</guid>
		<description><![CDATA[1. Create Table
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[tbl_Test](
 [Id] [int] NULL,
 [Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
 
GO
SET ANSI_PADDING OFF

2. Insert Record
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES (1,&#8216;a&#8217;)
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES (2,&#8216;b&#8217;)
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES (3,&#8216;c&#8217;)
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES (1,&#8216;a&#8217;)
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES (3,&#8216;c&#8217;)
INSERT INTO [Test].[dbo].[tbl_Test]([Id] ,[Name]) VALUES [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=20&subd=dotnethacker&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="MsoListParagraph" style="text-indent:-0.25in;"><!--[if !supportLists]--><span><span>1.<span style="font-family:&quot;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span></span><!--[endif]-->Create Table</p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">SET</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">ANSI_NULLS</span> <span style="color:blue;">ON</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;">GO</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">SET</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">QUOTED_IDENTIFIER</span> <span style="color:blue;">ON</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;">GO</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">SET</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">ANSI_PADDING</span> <span style="color:blue;">ON</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;">GO</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">CREATE</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">TABLE</span> [dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span> </span>[Id] [int] <span style="color:gray;">NULL,</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"><span> </span>[Name] [varchar]<span style="color:gray;">(</span>50<span style="color:gray;">)</span> <span style="color:blue;">COLLATE</span> SQL_Latin1_General_CP1_CI_AS <span style="color:gray;">NULL</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:gray;">)</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">ON</span> [PRIMARY]</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;">GO</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">SET</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">ANSI_PADDING</span> <span style="color:blue;">OFF</span></span></p>
<p class="MsoListParagraphCxSpFirst">
<p class="MsoListParagraphCxSpLast" style="text-indent:-0.25in;"><!--[if !supportLists]--><span><span>2.<span style="font-family:&quot;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span></span><!--[endif]-->Insert Record</p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>1<span style="color:gray;">,</span><span style="color:red;">&#8216;a&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>2<span style="color:gray;">,</span><span style="color:red;">&#8216;b&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>3<span style="color:gray;">,</span><span style="color:red;">&#8216;c&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>1<span style="color:gray;">,</span><span style="color:red;">&#8216;a&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>3<span style="color:gray;">,</span><span style="color:red;">&#8216;c&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>4<span style="color:gray;">,</span><span style="color:red;">&#8216;m&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>5<span style="color:gray;">,</span><span style="color:red;">&#8216;p&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>4<span style="color:gray;">,</span><span style="color:red;">&#8216;m&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>6<span style="color:gray;">,</span><span style="color:red;">&#8216;d&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>7<span style="color:gray;">,</span><span style="color:red;">&#8216;y&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>8<span style="color:gray;">,</span><span style="color:red;">&#8216;o&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;line-height:115%;font-family:&quot;color:blue;">INSERT</span><span style="font-size:10pt;line-height:115%;font-family:&quot;"> <span style="color:blue;">INTO</span> [Test]<span style="color:gray;">.</span>[dbo]<span style="color:gray;">.</span>[tbl_Test]<span style="color:gray;">(</span>[Id] <span style="color:gray;">,</span>[Name]<span style="color:gray;">)</span> <span style="color:blue;">VALUES</span><span> </span><span style="color:gray;">(</span>9<span style="color:gray;">,</span><span style="color:red;">&#8216;f&#8217;</span><span style="color:gray;">)</span></span></p>
<p class="MsoListParagraphCxSpFirst">
<p class="MsoListParagraphCxSpLast" style="text-indent:-0.25in;"><!--[if !supportLists]--><span><span>3.<span style="font-family:&quot;font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span></span><!--[endif]-->Find the duplicate record <span> </span>on the basis on Name field</p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">1)</span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">SELECT</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">DISTINCT</span> <span style="color:gray;">*</span> <span style="color:blue;">FROM</span><span> </span>dbo<span style="color:gray;">.</span>tbl_Test A</span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">WHERE</span><span style="font-size:10pt;font-family:&quot;"> 1<span style="color:gray;">&lt;(</span><span style="color:blue;">SELECT</span> <span style="color:fuchsia;">COUNT</span><span style="color:gray;">(*)</span> <span style="color:blue;">FROM</span> tbl_Test B</span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">WHERE</span><span style="font-size:10pt;font-family:&quot;"> A<span style="color:gray;">.</span><span style="color:blue;">nAME</span><span style="color:gray;">=</span>B<span style="color:gray;">.</span><span style="color:blue;">NAME</span><span style="color:gray;">)</span><span style="color:blue;">ORDER</span> <span style="color:blue;">BY</span> A<span style="color:gray;">.</span><span style="color:blue;">NAME</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;"><span style="font-size:10pt;font-family:&quot;color:blue;"> </span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">2)</span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">SELECT</span><span style="font-size:10pt;font-family:&quot;"> ID<span style="color:gray;">,</span> <span style="color:blue;">NAME</span><span> </span><span style="color:blue;">FROM</span><span> </span>dbo<span style="color:gray;">.</span>tbl_Test</span></p>
<p class="MsoNormal" style="line-height:normal;margin:0 0 0.0001pt 0.5in;"><span style="font-size:10pt;font-family:&quot;color:blue;">GROUP</span><span style="font-size:10pt;font-family:&quot;"> <span style="color:blue;">BY</span> <span style="color:blue;">NAME</span><span style="color:gray;">,</span>ID </span></p>
<p class="MsoListParagraph" style="margin-left:1in;"><span style="font-size:10pt;line-height:115%;font-family:&quot;color:blue;">HAVING</span><span style="font-size:10pt;line-height:115%;font-family:&quot;"> <span style="color:fuchsia;">COUNT</span><span style="color:gray;">(*)&gt;</span>1</span></p>
<p class="MsoNormal"><strong><span style="font-size:12pt;line-height:115%;"> </span></strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotnethacker.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotnethacker.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotnethacker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotnethacker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotnethacker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotnethacker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotnethacker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotnethacker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotnethacker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotnethacker.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotnethacker.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotnethacker.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=20&subd=dotnethacker&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotnethacker.wordpress.com/2008/05/27/find-duplicate-row-in-table-in-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a4569660033e084ca73354bbd3c0719?s=96&#38;d=identicon" medium="image">
			<media:title type="html">rajesh20k</media:title>
		</media:content>
	</item>
		<item>
		<title>FAQ in SQL 2000/2005</title>
		<link>http://dotnethacker.wordpress.com/2007/08/11/faq-in-sql-20002005/</link>
		<comments>http://dotnethacker.wordpress.com/2007/08/11/faq-in-sql-20002005/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 17:54:53 +0000</pubDate>
		<dc:creator>Rajesh</dc:creator>
				<category><![CDATA[SQL Question]]></category>

		<guid isPermaLink="false">http://dotnethacker.wordpress.com/2007/08/11/faq-in-sql-20002005/</guid>
		<description><![CDATA[FAQ in SQL 2000/2005
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=11&subd=dotnethacker&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://dotnethacker.files.wordpress.com/2007/08/faqsql.doc" title="FAQ in SQL 2000/2005">FAQ in SQL 2000/2005</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotnethacker.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotnethacker.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotnethacker.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotnethacker.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotnethacker.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotnethacker.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotnethacker.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotnethacker.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotnethacker.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotnethacker.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotnethacker.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotnethacker.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=11&subd=dotnethacker&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotnethacker.wordpress.com/2007/08/11/faq-in-sql-20002005/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a4569660033e084ca73354bbd3c0719?s=96&#38;d=identicon" medium="image">
			<media:title type="html">rajesh20k</media:title>
		</media:content>
	</item>
		<item>
		<title>Interview question in SQL</title>
		<link>http://dotnethacker.wordpress.com/2007/08/03/interview-question-in-sql/</link>
		<comments>http://dotnethacker.wordpress.com/2007/08/03/interview-question-in-sql/#comments</comments>
		<pubDate>Fri, 03 Aug 2007 17:52:03 +0000</pubDate>
		<dc:creator>Rajesh</dc:creator>
				<category><![CDATA[SQL Question]]></category>

		<guid isPermaLink="false">http://dotnethacker.wordpress.com/2007/08/03/interview-question-in-sql/</guid>
		<description><![CDATA[Which of the following data types has the highest data type precedence?
A. INT
B. VARCHAR
C. DATETIME
D. FLOAT
E. NUMERIC
F. MONEY
ans :- Here is the order of data type precedence of the given options from highest to lowest: DATETIME, FLOAT, NUMERIC, MONEY, INT and VARCHAR.
2) What&#8217;s the maximum number of columns can you include in a SELECT statement?
A. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=4&subd=dotnethacker&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Which of the following data types has the highest data type precedence?</p>
<p>A. INT<br />
B. VARCHAR<br />
C. DATETIME<br />
D. FLOAT<br />
E. NUMERIC<br />
F. MONEY</p>
<p>ans :- Here is the order of data type precedence of the given options from highest to lowest: DATETIME, FLOAT, NUMERIC, MONEY, INT and VARCHAR.</p>
<p>2) What&#8217;s the maximum number of columns can you include in a SELECT statement?</p>
<p>A. 512<br />
B. 1,024<br />
C. 2,048<br />
D. 4,096</p>
<p>ANS<br />
Although the maximum number of columns a table can have is 1,024, the maximum number of columns that can be specified in a SELECT statement is 4,096.</p>
<p>3) Which of the following is NOT a valid description of the public role?</p>
<p>A. The public role captures all default permissions for users in a database.<br />
B. The public role cannot be dropped.<br />
C. The public role is contained in every database, including msdb, tempdb, model, and all user databases except in the master database for security purposes.<br />
D. The public role cannot have users, groups, or roles assigned to it.</p>
<p>ans:-<br />
All of these statements are valid description of the public role except for the third option because the public role is also contained in the master database.<br />
4)<br />
What will be the output of the following statement?</p>
<p>SELECT CHARINDEX(&#8216;is&#8217;, &#8216;Missississippi&#8217;, 0)</p>
<p>A. 0<br />
B. 2<br />
C. NULL<br />
D. Statement will generate an error.  The CHARDINDEX function only accepts 2 parameters.</p>
<p>Your Answer : D</p>
<p>Correct Answer : B</p>
<p>Explanation:<br />
The CHARINDEX function returns the starting position of the specified expression in a character string. The third parameter of the CHARINDEX functions is the character position to start searching for the first parameter in the second parameter. If the starting location is 0, the search starts at the beginView text definitions are stored in which system table?</p>
<p>A. sysobjects<br />
B. syscolumns<br />
C. syscomments<br />
D. sysviews</p>
<p>Your Answer : A</p>
<p>Correct Answer : C</p>
<p>Explanation:<br />
The syscomments system table contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint and stored procedure. The text column contains the original SQL definition statements.<br />
ning of the second parameter.</p>
<p>5)<br />
View text definitions are stored in which system table?</p>
<p>A. sysobjects<br />
B. syscolumns<br />
C. syscomments<br />
D. sysviews</p>
<p>Your Answer : A</p>
<p>Correct Answer : C</p>
<p>Explanation:<br />
The syscomments system table contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint and stored procedure. The text column contains the original SQL definition statements.</p>
<p>6)<br />
What will be the output of the following statement?</p>
<p>SELECT CHARINDEX(&#8216;is&#8217;, &#8216;Missississippi&#8217;, 3)</p>
<p>A. 2<br />
B. 5<br />
C. 8<br />
D. 9<br />
E. -1<br />
F. 0</p>
<p>Your Answer : B</p>
<p>Correct Answer : B</p>
<p>Explanation:<br />
The CHARINDEX function returns the starting position of the specified expression in a character string. The third parameter of the CHARINDEX functions is the character position to start searching for the first parameter in the second parameter.</p>
<p>7<br />
What will be the result of the following statement?</p>
<p>SELECT CAST(-1 AS DATETIME)</p>
<p>A. 1900-01-01 00:00:00.000<br />
B. 1899-01-01 00:00:00.000<br />
C. 1899-12-31 00:00:00.000<br />
D. 1752-01-01 00:00:00.000<br />
E. 1752-12-31 00:00:00.000<br />
F. The statement will generate an error.  Only positive integer values can be converted to a DATETIME data type.</p>
<p>Your Answer : F</p>
<p>Correct Answer : C</p>
<p>Explanation:<br />
A DATETIME data type is stored internally in SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date of January 1, 1900. Given this, a value of 0 corresponds to January 1, 1900 and a value of -1 corresponds to 1 day before the base date, December 31, 1899.</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> What will be the result of the following statement?</p>
<p>SELECT CAST(-1 AS DATETIME)</p>
<p>A. 1900-01-01 00:00:00.000<br />
B. 1899-01-01 00:00:00.000<br />
C. 1899-12-31 00:00:00.000<br />
D. 1752-01-01 00:00:00.000<br />
E. 1752-12-31 00:00:00.000<br />
F. The statement will generate an error.  Only positive integer values can be converted to a DATETIME data type.</p>
<p>Your Answer : F</p>
<p>Correct Answer : C</p>
<p>Explanation:<br />
A DATETIME data type is stored internally in SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date of January 1, 1900. Given this, a value of 0 corresponds to January 1, 1900 and a value of -1 corresponds to 1 day before the base date, December 31, 1899.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/dotnethacker.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/dotnethacker.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dotnethacker.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dotnethacker.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dotnethacker.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dotnethacker.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dotnethacker.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dotnethacker.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dotnethacker.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dotnethacker.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dotnethacker.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dotnethacker.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dotnethacker.wordpress.com&blog=1463994&post=4&subd=dotnethacker&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://dotnethacker.wordpress.com/2007/08/03/interview-question-in-sql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0a4569660033e084ca73354bbd3c0719?s=96&#38;d=identicon" medium="image">
			<media:title type="html">rajesh20k</media:title>
		</media:content>
	</item>
	</channel>
</rss>