<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4845388394560626212</id><updated>2024-09-12T06:32:54.362-07:00</updated><category term=".NET"/><category term="C#"/><category term="OOPs"/><category term="Object Oriented Programming"/><title type='text'>CrazyWebDeveloperCenter</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-2211474709904465936</id><published>2011-03-28T22:30:00.000-07:00</published><updated>2011-03-28T22:35:37.246-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><title type='text'>General Puzzle1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;This is very simple code which every one might have faced but you didn&#39;t have noted this. Is that possible to create a static void main with int as return type like code shown below?&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;class Program
    {
        static int Main(string[] args)
        {
            return 0;
        }
    }
&lt;/pre&gt;And is it possible to pass int args instead of string args like this?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;class Program
    {
        static void Main(int[] args)
        {
        }
    }
&lt;/pre&gt;&lt;br /&gt;
Please dont Execute code.....&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/2211474709904465936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/03/general-puzzle1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/2211474709904465936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/2211474709904465936'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/03/general-puzzle1.html' title='General Puzzle1'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-7079817306123522095</id><published>2011-03-06T21:11:00.000-08:00</published><updated>2011-03-06T21:11:47.358-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Object Oriented Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="OOPs"/><title type='text'>Oops Puzzle1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Object Oriented Programming seems to be tricky usually. This Puzzle is based on Inheritance.&lt;br /&gt;
&lt;br /&gt;
Consider there are 2 Classes&lt;br /&gt;
Class A and Class B&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;class Program
    {
        
        static void Main(string[] args)
        {
            ClassA _objClassA = new ClassB();
            _objClassA.Function1(); 
        }
    }

public Class ClassA
{
    public void Function1()
    {
         Console.WriteLine(&quot;ClassA...Function1()&quot;);
    }
}
public class ClassB:ClassA
{
    public void Function1()
    {
         Console.WriteLine(&quot;ClassB...Function1()&quot;);
    }
}


&lt;/pre&gt;What is the Result of the above Program.&lt;br /&gt;
&lt;b&gt;Please do not execute this program. Try to solve by looking code.&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/7079817306123522095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/03/oops-puzzle1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/7079817306123522095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/7079817306123522095'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/03/oops-puzzle1.html' title='Oops Puzzle1'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-6407686311719993305</id><published>2011-02-17T11:47:00.000-08:00</published><updated>2011-04-18T22:45:48.791-07:00</updated><title type='text'>SQL Puzzle1</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
Very Recently i faced one Problem, struggled a lot to Find Solution, but didn&#39;t find that solution yet. So trying to share that Problem with you all.&lt;br /&gt;
Consider there are two tables. &lt;b&gt;Table 1&lt;/b&gt; and &lt;b&gt;Table 2&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Table 1&lt;/b&gt; Contain Following Details&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Question_Id&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Question&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;Question1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Question2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;Question3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;Question4&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;Table 2&lt;/b&gt; Contain Following Details&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;Question_Id&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Option_Id&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Options&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;Q1Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;Q1Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;Q1Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;Q1Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;21&lt;/td&gt;&lt;td&gt;Q2Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;22&lt;/td&gt;&lt;td&gt;Q2Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;Q2Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;24&lt;/td&gt;&lt;td&gt;Q2Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;31&lt;/td&gt;&lt;td&gt;Q3Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;32&lt;/td&gt;&lt;td&gt;Q3Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;33&lt;/td&gt;&lt;td&gt;Q3Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;&lt;td&gt;Q3Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;35&lt;/td&gt;&lt;td&gt;Q3Option5&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;36&lt;/td&gt;&lt;td&gt;Q3Option6&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;41&lt;/td&gt;&lt;td&gt;Q4Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;42&lt;/td&gt;&lt;td&gt;Q4Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;43&lt;/td&gt;&lt;td&gt;Q4Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;44&lt;/td&gt;&lt;td&gt;Q4Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;45&lt;/td&gt;&lt;td&gt;Q4Option5&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
Now we have to write a Query that should return a Table in a Below Stated format.&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;ID&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;QuestionOption&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Question1&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;Q1Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;Q1Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;13&lt;/td&gt;&lt;td&gt;Q1Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;14&lt;/td&gt;&lt;td&gt;Q1Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Question2&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;21&lt;/td&gt;&lt;td&gt;Q2Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;22&lt;/td&gt;&lt;td&gt;Q2Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;Q2Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;24&lt;/td&gt;&lt;td&gt;Q2Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Question3&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;31&lt;/td&gt;&lt;td&gt;Q3Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;32&lt;/td&gt;&lt;td&gt;Q3Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;33&lt;/td&gt;&lt;td&gt;Q3Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;34&lt;/td&gt;&lt;td&gt;Q3Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;35&lt;/td&gt;&lt;td&gt;Q3Option5&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;36&lt;/td&gt;&lt;td&gt;Q3Option6&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Question4&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;41&lt;/td&gt;&lt;td&gt;Q4Option1&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;42&lt;/td&gt;&lt;td&gt;Q4Option2&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;43&lt;/td&gt;&lt;td&gt;Q4Option3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;44&lt;/td&gt;&lt;td&gt;Q4Option4&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;45&lt;/td&gt;&lt;td&gt;Q4Option5&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Condition:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;Never use &lt;b&gt;UNION&lt;/b&gt; and &lt;b&gt;LOOP&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Thank you&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/6407686311719993305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/sql-puzzle1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/6407686311719993305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/6407686311719993305'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/sql-puzzle1.html' title='SQL Puzzle1'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-2179592684968231591</id><published>2011-02-13T20:54:00.000-08:00</published><updated>2011-03-28T23:46:48.466-07:00</updated><title type='text'>SQL SELECT Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;This is one of the good puzzle i heard from my Interview.&lt;br /&gt;
&lt;div&gt;When i went for an Interview, interviewer asked me one good Puzzle in &lt;b&gt;SQL&lt;/b&gt; , Quite Simple but really very Good Puzzle.&amp;nbsp;&lt;/div&gt;&lt;div&gt;Question:&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Consider a Local Variable, &lt;br /&gt;
&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;DECLARE @Name Varchar(50)=NULL&lt;/pre&gt;&lt;/div&gt;&lt;pre class=&quot;sql&quot; name=&quot;code&quot;&gt;SELECT FirstName+ &#39; &#39;+LastName FROM Employee WHERE FirstName=@Name
&lt;/pre&gt;Question is very simple,&lt;br /&gt;
When value is passed through that variable then it should execute complete &lt;b&gt;SELECT &lt;/b&gt;statement with &lt;b&gt;WHERE &lt;/b&gt;Clause, if value is not passed then &lt;b&gt;SELECT &amp;nbsp;&lt;/b&gt;statement should execute without &lt;b&gt;WHERE &lt;/b&gt;Clause.&lt;br /&gt;
Eg:&lt;br /&gt;
&amp;nbsp;Consider there are 5 Records in that &lt;b&gt;Employee Table&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;ID&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;FirstName&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;LastName&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;EmailId&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;ContactNo&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Anand&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Kumar&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;anand1@gmail.com&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;9898989898&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Anderson&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;anderson@gmail.com&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;9898989898&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Arnold&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;schwarzenegger&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;arnold@yahoo.com&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;9898989898&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;4&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;David&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Blaine&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;david@gmail.com&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;9898989898&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;&lt;b&gt;5&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Ranbir&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Kapoor&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Ranbir@gmail.com&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;9898989898&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
If we pass &lt;b&gt;@Name=&#39;Anand&#39;&lt;/b&gt; then it should return First Record with FirstName and LastName.&lt;br /&gt;
If we are not passing any value then obviously &lt;b&gt;@Name&lt;/b&gt; is &lt;b&gt;Null&lt;/b&gt; as it is declared as NULL, so it should return all records with FirstName and LastName.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Condition&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; You should never use two set of Select Query (Some people will say we can use IF Statement and can write two set of &amp;nbsp;Queries, one with WHERE Clause and one without WHERE Clause-&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;never do this&lt;/span&gt;&lt;/b&gt;).&lt;br /&gt;
&lt;div&gt;Thank you&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/2179592684968231591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/sql-select-puzzle.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/2179592684968231591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/2179592684968231591'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/sql-select-puzzle.html' title='SQL SELECT Puzzle'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-7026170028774770927</id><published>2011-02-13T09:50:00.000-08:00</published><updated>2011-03-28T23:49:27.880-07:00</updated><title type='text'>Executing one ASP.NET Page from Another</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Very recently i faced one problem where i want to execute one ASP.NET Page from Another Page just by calling inside some Function. Let we take this&amp;nbsp;Scenario.&lt;br /&gt;
&lt;br /&gt;
I have changed my code to dummy code as i cant write my real code here due to&lt;strong&gt; Copyright Violation. &lt;/strong&gt;First i will discuss about that Problem.&lt;br /&gt;
&lt;br /&gt;
Consider there are two ASP.NET Pages,&amp;nbsp;&lt;strong&gt;Page1.aspx&lt;/strong&gt; and &lt;strong&gt;Page2.aspx&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Page1.aspx :&lt;/strong&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;protected void Page_Load(object sender,EventArgs e)

{

Function1();

Function2();

Function3();

}

protected void Function1()

{

Response.Write(&quot;Function1&quot;);

}

protected void Function2()

{

Response.Write(&quot;Function2&quot;);

//Call Page2.aspx

}

protected void Function3()

{

Response.Write(&quot;Function3&quot;);

}&lt;/pre&gt;&lt;strong&gt;Page2.aspx:&lt;/strong&gt;&lt;br /&gt;
&lt;pre class=&quot;c#&quot; name=&quot;code&quot;&gt;protected void Page_Load(object sender,EventArgs e)

{

Response.Write(&quot;Page2&quot;);

}&lt;/pre&gt;Now we need result like this,&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;br /&gt;
&lt;blockquote&gt;Function1&lt;br /&gt;
&lt;br /&gt;
Function2&lt;br /&gt;
&lt;br /&gt;
Page2&lt;br /&gt;
&lt;br /&gt;
Function3&lt;/blockquote&gt;How will you do this? &lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/7026170028774770927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/executing-one-aspnet-page-from-another.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/7026170028774770927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/7026170028774770927'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/executing-one-aspnet-page-from-another.html' title='Executing one ASP.NET Page from Another'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4845388394560626212.post-8924881070840983814</id><published>2011-02-13T09:39:00.001-08:00</published><updated>2011-04-18T00:04:31.382-07:00</updated><title type='text'>Beware of Implicit Datatype Conversion in SQL Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Do you know SQL Server does Implicit Conversion in Queries? If you know that then you are safe. If you don&#39;t then please don&#39;t miss reading this Complete Article.&lt;br /&gt;
&lt;br /&gt;
Now we&#39;ll create a Test Table and Insert Some Values, to understand this concept more clearly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;sql&quot;&gt;CREATE TABLE [dbo].[Test3]( [N1] [int] NOT NULL CONSTRAINT [PK_Test3] PRIMARY KEY,
[V1] [nvarchar](10) NULL,&amp;nbsp;)
INSERT INTO Test3 VALUES(1,&#39;1000&#39;)
INSERT INTO Test3 VALUES (2,&#39;1001&#39;)
INSERT INTO Test3 VALUES (3,&#39;1003&#39;)
INSERT INTO Test3 VALUES (4,&#39;1004&#39;)
INSERT INTO Test3 VALUES (5,&#39;200&#39;)
&lt;/pre&gt;If we try to do&lt;br /&gt;
&lt;pre name=&quot;code&quot; class=&quot;sql&quot;&gt;SELECT * FROM Test3 WHERE V1&amp;gt;1002
&lt;/pre&gt;Will it Work? It will work. This is where Implicit Conversion is Happening. Whenever SQL Server finds Arithmetic Operator it will convert string to Number if it can do that. This Facility is not Provided in DB2. It will throw exception. But thats a good advantage in DB2. So that people will never get in trap.&lt;br /&gt;
&lt;br /&gt;
Output for Above Query will be&lt;br /&gt;
&lt;blockquote&gt;&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;N1&lt;/td&gt; &lt;td&gt;V1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;3&lt;/td&gt; &lt;td&gt;1003&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;4&lt;/td&gt; &lt;td&gt;1004&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;5&lt;/td&gt; &lt;td&gt;200&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;/blockquote&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://crazywebdevelopercenter.blogspot.com/feeds/8924881070840983814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/beware-of-implicit-datatype-conversion.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/8924881070840983814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4845388394560626212/posts/default/8924881070840983814'/><link rel='alternate' type='text/html' href='http://crazywebdevelopercenter.blogspot.com/2011/02/beware-of-implicit-datatype-conversion.html' title='Beware of Implicit Datatype Conversion in SQL Server'/><author><name>vinothvs</name><uri>http://www.blogger.com/profile/18175593870796356025</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>