<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<rss version="2.0">
<channel>
	<title>Welcome to Shivshanker&#039;s Blog</title> 
	<description>I struggled to solve some problems so i want to share my solutions and who use these code they once test it and use it. </description> 
	<link>http://sscheral.atwiki.com/</link> 



		<item>
		<title>
			 <![CDATA[ Important SQL Code ]]> 
		</title>
		<description>
			<![CDATA[ 
==============================================================================================================================
EXEC sp_helptext vwProductSales
--This stored procedure is used to get the depends details means reference key,
foreign keys etc...
EXEC sp_depends vwProductSales
EXEC sp_depends products
==============================================================================================================================
select rows from 5 to 15 without id coloumn
First take top 15 records and minus top 5
records.
select top 10 * from Emp where eno not
in(select top 5 eno from Emp)
==============================================================================================================================
gives percentage of rows
TOP n [PERCENT]
n specifies how many rows are returned. If PERCENT is not specified, n is the
number of rows to return. If PERCENT is specified, n is the percentage of the
result set rows to return:
TOP 120 /*Return the top 120 rows of the
result set. */
TOP 15 PERCENT /* Return the top 15% of the result set. */
==============================================================================================================================
To select duplicate row count from the table
select count(name),name from list
ã€€ã€€ group by name
ã€€ã€€ã€€ having count(name) &amp;gt; 1
to delete duplicate rows from the table
delete from list where (id) not in (select min(id) as id from list group by
name)
to delete without id table
SETã€€ã€€ã€€ã€€ã€€ã€€ ROWCOUNT 1 DELETE testing
FROMã€€ã€€ã€€ã€€ testing a
WHEREã€€ã€€ (SELECTã€€ã€€ COUNT(*)
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ FROMã€€ã€€ã€€ã€€ testing b
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ WHEREã€€ã€€ b.id = a.id AND b.name = a.name)
&amp;gt; 1 WHILE @@rowcount &amp;gt; 0 DELETE testing
FROMã€€ã€€ã€€ã€€ testing a
WHEREã€€ã€€ (SELECTã€€ã€€ COUNT(*)
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ FROMã€€ã€€ã€€ã€€ testing b
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ WHEREã€€ã€€ b.id = a.id AND b.name = a.name)
&amp;gt; 1
SETã€€ã€€ã€€ã€€ã€€ã€€ ROWCOUNT 0
========================================================================================================================
to get the comma seperated string from a table
Declare @str Varchar(100)
-- Forming the comma separated string
Select @str= COALESCE(@str+',' , '') + Val from vin_temp
Select @str
========================================================================================================================
to get stored proecedure detail using query we can use this command
SELECT OBJECT_DEFINITION (OBJECT_ID ('&amp;lt;name
of SP&amp;gt;') )
where &amp;lt;name of SP&amp;gt; is Stored Procedure
Name
========================================================================================================================
To transfer data from one server to another
server by using Query
1) First Execute the Stored procedure
sp_addlinkedserver
&amp;lt;ServerName&amp;gt;
e.g. sp_addlinkedserver Ravi1
2) Then execute the query

Select * from Server.Database.Owner.Table
e.g. select * from
Ravi1.Stars_db.dbo.validsurveys
========================================================================================================================
Selecting nth highest salary in bellow query
change the number
6 to any position then it gives highest salary of that position -1
means if it 6 then it gives 7th highest salary
if it 4 then it gives 5th highest and so on.
select salary from emp e
where 6 = ( Select count(distinct(sal)) from emp e1 where e.sal &amp;lt;
e1.sal)

-- selects nth highest salary bellow ine picks
6th highest salary
select Top 1 sal from emp where sal in(Select Top 6 sal from emp order by desc)
order by sal ASC
select MIN(sal) from emp where sal in(Select
Top 6 sal from emp order by desc)
--We can get random records every time by
using this query
select top 5 * from answer order by newid()
========================================================================================================================
Microsoft introduced the EXCEPT operator in SQL Server 2005, which returns all
of the distinct rows from the left side of the EXCEPT operator. It also removes
all of the rows from the result set that match the rows that are on the right
side of the EXCEPT operator.
eg:
SELECT C1,C2 FROM T1 EXCEPT SELECT C1,C2 FROM
T2
SELECT C1,C2 FROM T2 EXCEPT SELECT C1,C2 FROM T1
SELECT c1,c2 FROM t1 INTERSECT SELECT c1,c2
FROM t2
========================================================================================================================
-- selecting all column names from all tables
Select TABLE_CATALOG = Left(TABLE_CATALOG,
10),
TABLE_SCHEMA = Left(TABLE_SCHEMA, 10),
TABLE_NAME = Left(TABLE_NAME, 10),
COLUMN_NAME = Left(COLUMN_NAME, 20)
From stars_db.Information_Schema.Columns
Where Table_Name like 'S000%'

Select TABLE_CATALOG ,
TABLE_SCHEMA,
TABLE_NAME ,
COLUMN_NAME
From stars_db.Information_Schema.Columns
Where Table_Name like 'S000%' AND COLUMN_NAME LIKE 'ValidC%'
========================================================================================================================
select
1 A
2 B
3 C
like A,B,C........
declare @n varchar(1500)
set @n=''
select @n=@n + convert(varchar(10),QuestionID) + ',' from answer
select @n
declare @str nVARCHAR(4000)
select @str = COALESCE(@str+',','Start ') + convert(varchar(10),QuestionID)ã€€
from answer
select @str
========================================================================================================================
-- To get Table Created and modified date
Select name,create_date,modify_date From sys.tables

========================================================================================================================
To set Identity seed to any number use this following comman
DBCC CHECKIDENT('tablename', RESEED,
10)
'Tablename is table name which you want to
reseed and 10 the start seed for the table means it start from 10 it inserts
next record with id 11 ,12,...
========================================================================================================================
http://sscheralbidar.blog.co.uk http://sscheral.atwiki.com
http://sscheral.spaces.live.com/
 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/Important%20SQL%20Code
		</link>
		<pubDate>Fri, 11 Dec 2009 12:17:21 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ SQL Question Answer-1 ]]> 
		</title>
		<description>
			<![CDATA[ 
These are questions that I have colleted from many
jobs. I hoped these will help any of you in preparing before person to person
or group job interview for .NETFramework and SQL SERVER
Databases. ã€€
Q. Revisiting Basic Syntax of SQL?
CREATE TABLE Color Table
(code Varchar(2),
ColorValue Varchar (16)
)
INSERT INTO Color Table (code,
colorvalue) VALUE ('b1', 'brown')
DELETE FROM Color Table WHERE code =
'B1'
UPDATE Color Table SET colorvalue =
'black' where code ='b1'
DROP TABLE table Name
(CASCADE|RESTRICT)
GRAND SELECT ON Color Table TO
SHIVKOIRALA WITH GRANT OPTION
REVOKE SELECT, INSERT, UPDATE
(ColorCode) ON ColorTable FROM SHIVKOIRALA
COMMIT [WORK]
ROLLBACK [WORK]
Select * from Person
Address
Select Addressline1, city from
person.Address
Select Addressline1, city from
person.Address Where city = 'SAIGON'
Q. What are &quot;GRANT&quot; and &quot;REVOKE&quot;
statement?
Ans: GRANT statement grants rights to
the objects (Table). While REVOKE does the vice-versa
of it, it removeds rights from the
object.
Q. What is Casscade and Restric in DROP table in
SQL?
Twist: What is &quot;ON DELETE CASSCADE&quot; and
&quot;ON DELETE RESTRICT&quot;?
RESTRICT: specifies that table should
not be dropped if any dependencies (i.e. triggers, stored procedure, primary
key, foreing key etc)exist. So if there are dependencies then error is
generated and the object is dropped.
CASCADE: Specifies that even if there
dependencies go ahead and drop. That means drop the dependencies first and then
the main object also.ã€€So if table has stored Procedures and keys(Primary and
secondary keys) they are drop first and then the table is finally
dropped.
Q. How to import table using &quot;INSERT&quot;
statement?
Ans: I have made a new temporary color
table which is flourished using the belows SQL. Structures of both of the table
should be the same in order that SQL execute properly.
INSERT INTO TempcolorTable
SELECT Code, colorvalue
FROM ColorTable
Q. What is a DLL, DML, and DCL concept in RDBMS
World?
Ans:
DLL: (Data definition language) defines
your database structure. CREATE and ALTER are DLL
statements as they affect the way your
database structure organized.
DML: (Data Manipulation Language) lets
you do basic functionalities like INSERT, UPDATE, DELETE, and MODIFY data in
database.
DCL: (Data Control Language) controls
your DML, and DLL Statements so that your data is proctected and has
consistency.ã€€ COMITT and ROLLBACK are DCL control statements. DCL gurantees
ACID fundatmentals of a transaction.
Q.What are diffeferent types of Joins in
SQL?
Ans: INNER JOIN: Inner join show matches
only when they exist in both tables. Example in the below SQL there are two
tables Customers and Orders and the inner join is made customers.cutomerid and
order.customerid.ã€€ So this SQL Statement on ly give you result with customers
who has orders. If the customer does not have order it will not display that
record.
SELECT Customers.*, Orders.* FROM
Customers INNER JOIN Orders ON
Customers.customerid=Orders.customerid
Q. LEFT OUTER JOIN
Ans: Left join will display all records
in left table of SQL statement.ã€€ In SQL below customers with or with out
orders will be displayed. Order data for customers without Orders appears as
NULL values. For example, you want to determinethe amount ordered by each
customer and you need to see who has not ordered anything as well. You can also
see LEFT OUTER JOIN as a mirror image of the RIGHT OUTER JOIN if you switch the
side of each table.
SELECT Customers.*, Orders.* FROM
Customers LEFT OUTER JOIN Orders ON
Customers.customerid=Orders.customerid
Q. RIGHT OUTER JOIN
Ans: RIGHT join will display all records
in right table of SQL statement.ã€€ In SQL below all Orders with or without
matching customers records will be displayed.ã€€Customer data for Orders
without Customers appears as NULL values. For example, you want to determine if
there are any orders in the data with undefined CustomerID values(says, after a
conversion or sometthing like it). You can also see RIGHT OUTER JOIN as a
mirror image of the LEFT OUTER JOIN if you switch the side of each
table.
SELECT Customers.*, Orders.* FROM
Customers RIGHT OUTER JOIN Orders ON
Customers.customerid=Orders.customerid
Q. What is &quot;CROSS JOIN&quot;?
Ans: &quot;CROSS JOIN&quot; or &quot;CARTESIAN PRODUCT&quot;
combines all rows from both tables. Number of rows will be product of the
number of rows in each table. In real life scenario I can not imagine where we
will want to use a Cartesian product. But there are scenarios where we would
like permutation and combineation probably Cartesian would be the easiest way
to achieve it.
Q. You want to select the first record in a given set of
rows?
Select top 1 * FROM
Sales.person
Q:How do you sort in SQL?
Ans:
Using &quot;ORDER BY&quot; clause, you either sort
data in ascending manner or descending manner.
Select * From Sales.Saleperson order by
salepersonid asc
Select * FROM Sales.saleperson order by
salepersonid desc
Q. How do you select unique rows using
SQL?
Ans: Using the &quot;DISTINCT&quot; clause, for
example if you fire the below SQL in &quot;ADventureWorks&quot;, first SQL will give you
distinct value for cities, while order will give you disctinct
rows.
Select distinct city from
person.address
Slect distinct * from
person.address
Q. Can you name some aggregate functions in SQL
Server?
Some of them which every interviewer
will expect:
AVG: Computes the average of a specific set
of values, which can be an expressionlist or set of data records in a
table.
SUM: Returns the sum of a specific set of
values, which can be an expressions list or set of data records in a
table.
COUNT: Computers the number of data records
in a table.
MAX: Returns the maximum value from a
specific set of values, which can an expression list or a set of data records
in a table.
MIN: Returns the minimum value from a
specific set of values, which can be an expression or a set of data records in
a table
Q. What is the default &quot;SORT&quot; order for a
SQL?
Ans: ASCENDING
Q. What is a Self-join?
Ans: If you want two instance s of the
same table you can use self join.
Q. What's the different between DELETE and
TRUNCATE?
Ans: DELETE Table syntax logs the
deletes thus making the delete operation slow.
TRUNCATE Table does not log any
information but it logs informationabout deallocation of data pages of the
table. So TRUNCATE table is faster as compared to DELETE table.
DELETE table rolled back while TRUNCATE
can not be
DELETE table can have criteria while
TRUNCATE can not
TRUNCATE table ca not have
triggers.
Q. Slect address which between '1/1/2007' and
1/4/2007'?
Ans:
SELECT * FROM Person.Address where
modified date between '1/1/2007' and '1/4/2007'
Q. What are wildcard operators in SQL?
Ans: There are basically two types of
operators:
&quot;%&quot; operator (Percentage
Operator)
&quot;%&quot; operator searches for one to many
occurences. So when you fire a query using &quot;%&quot; SQL server searches for one or
many occurences.
&quot;_&quot; Operator (Underscore
operator)
&quot;_&quot; operator is the character defined at
that point. I have sample fiere in a query
Select Addressline1 from person.address
where addressline1 like '_h%'
so all data where second letter is &quot;h&quot;
is returned
Q. What's the difference between &quot;UNION&quot; and &quot;UNION
ALL&quot;
Ans: UNION SQL Syntax is used to select
information from two tables. But it selects only distinct records from both
tables, while UNION ALL slect all records from both of the tables.
To explain it practically below are one
fire&quot;UNION&quot; and one &quot;UNION ALL&quot; in the person Addres in
AdventureWorks:
Select * From
person.address
UNION
Select * from person.address :this
return 19614 rows ( that's mean it removes all duplicates)
Select * From
person.address
UNION ALL
Select * From person.address: this
return 39228 rows(&quot;UNION ALL&quot; does not check for duplicates so returns double
the record show above)
Q. What are cursors and what are the situations you will use
them?
Ans: SQL Statements are good for st at a
time operation. So it is good at handling set of data. But there are scenarios
where you want to update row depending on certain criteria. You will loop
through all rows and update data accordingly.ã€€ There's where cursors come
into picture.
NOTE: There are 5%of interviews have
asked questions about Cursors.
Q. What are the steps to create a
cursor?
Ans:
Below are the basic steps to execute a
cursor

·ã€€ã€€ã€€ã€€ Declare

·ã€€ã€€ã€€ã€€ Open

·ã€€ã€€ã€€ã€€ Fetch

·ã€€ã€€ã€€ã€€ Operation

·ã€€ã€€ã€€ã€€ Close and Deallocate
Below is a sample of TSQL display record
which have &quot;@Provinceid&quot; equal &quot;7&quot;
DECLARE @Provinceid int
--Declare Cursor
DECLARE @Provincecursor CURSOR
FOR
SELECT Stateprovincedid
FROM Person.Address
--Open cursor
OPEN provinceCursor
--Fetch data from cursor in to
variable
FETCH NEXT FROM
provincecursor
INTO @Provinceid
WHILE @@FETCH_STATUS = 0
BEGIN
--Do operation according to row
value
If @Provinceid = 7
begin
Print @Provinceid
end
--Fetch the next cursor
FETCH NEXT FROM
provincecursor
INTO @Provinceid
END
--Finally do not forget to close and
deallocate the cursor
CLOSE provincecursor
DEALLOCATE Provincecursor
Q. What are the different Cursor
type?
Ans:
Cursor types are assigned when we
declare a cursor
DECLARE Cursor_name CURSOR
[LOCAL|GLOBAL]
[FORWARD_ONLY | SCROLL]
[STATIC | KEYSET | DYNAMIC |
FAST_FORWARD]
[READ_ONLY | SCROLL_LOCKS |
OPIMISTIC]
[TYPE_WARNING]
FOR select_Statement
[FOR UPDATE [OF
column_list]]
STATIC: Static cursor is a fixed
snapshot of a set of rows. This fixed snapshot is stored in a temporary
database. As the cursor is using private snapshot any changes to the set of
rows external will not be visible in the cursor while browsing through it. You
can define a static cursor using &quot;STATIC&quot; keyword.
DECLARE cursorname CURSOR
STATIC
FOR SELECT * FROM Tablename
WHERE column1 = 2
KEYSET: the key values of the row s are
saved in tempdb. For instance let's say the cursor has fetch the following
below data. so only the &quot;Supplierid&quot; will be stored in the database. Any new
inserts happening is not reflected in the cursor. But any updates in the
key-set values are reflected in the cursor. Because the cursor is identifield
by key values you can also absolutely fetch them using &quot;FETCH ABSOLUTE 12 FROM
mycursor&quot;




SupplieID


Supplier Name




17


Evan and Evan limited




18


Han Brothers




19


European Supplier




20


Stocker




21


New supplier




DYNAMIC: In DYNAMIC cursor you can see
any kind of changes happening i.e. either inserting new records or changes in
the existing and even deletes. That's Dynamic cursor are slow and have least
performance.
FORWARD_ONLY: As the name suggest they
only move forward and only a one time fetch is done. In every fetch the cursor
evaluated. That means any changes to the data are known, until you have
specified &quot;STATIC&quot; or &quot;KEYSET&quot;
FAST_FORWARD: These types of cursor are
forward only and read_only and in every fetch they are not re-evaluated again.
This makes them a good choice in increase performance.
Q. Waht are &quot;GLOBAL&quot; and &quot;LOCAL&quot;
cursor?
Cursor are global for a connection. By
default cursor are global. That means you can declare a cursor in one stored
procedure and access it outside also. Local Cursor are accessible only inside
the object (Which can be a store procedure, trigger, or a function). You can
declare a cursor as &quot;Local&quot; or &quot;Global&quot; in the &quot;DECLARE&quot; cursor syntax. Refer
the &quot;DECLARE&quot; statement of the cursor in the previous statement.

 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/SQL%20Question%20Answer-1
		</link>
		<pubDate>Sun, 23 Aug 2009 13:02:12 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ How to retrieve the last day of the month .... Or Last date in the week ]]> 
		</title>
		<description>
			<![CDATA[ 
How to retrieve the last
day of the month .... Or Last date in the week?
Answer:
To add a addendum ... how can I find out the number of days in a given
month.
eg. If I were to give you '2003-03-01' I should get 31.
If you feel its a bit tricky in nature then ... See the solutions below ...
DECLARE @Date datetime
SET @Date = '2000/02/1'
SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 1),@Date) AS 'First day of the
week'
SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 7),@Date) AS 'Last day of the
week'
SELECT DAY(DATEADD(d, -DAY(DATEADD(m,1,@Date)),DATEADD(m,1,@Date))) AS 'Last
day of the month'
Since the Last Day would yield you the number of days in a month then it anwers
my addendum question also. Some more solutions for the number of days in a
month are below:
DECLARE @d DATETIME
SET @d = '2003-02-1'
select datepart(dd, dateadd(dd, -(datepart(dd, dateadd(mm, 1, @d))),dateadd(mm,
1, @d))) AS 'Last day of the month'
GO
DECLARE @d DATETIME
SET @d = '2000-02-1'
SELECT CASE WHEN MONTH(@d) = 1
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 2
ã€€ã€€ã€€ã€€ã€€ THEN CASE WHEN (YEAR(@d) % 4 = 0 AND YEAR(@d) % 100 &amp;lt;&amp;gt; 0)
OR
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ YEAR(@d) % 400 = 0
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ THEN 29
ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ã€€ ELSE 28
ã€€ã€€ã€€ã€€ã€€ END
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 3
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 4
ã€€ã€€ã€€ã€€ã€€ THEN 30
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 5
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 6
ã€€ã€€ã€€ã€€ã€€ THEN 30
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 7
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 8
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 9
ã€€ã€€ã€€ã€€ã€€ THEN 30
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 10
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 11
ã€€ã€€ã€€ã€€ã€€ THEN 30
ã€€ã€€ã€€ã€€ã€€ WHEN MONTH(@d) = 12
ã€€ã€€ã€€ã€€ã€€ THEN 31
ã€€ã€€ã€€ END AS 'Last day of the month'
Whew .... That's a mess to understand ... Believe me they work ... :-) ...
There are hundreds of way the SQL Selects can be done ... This is just few of
them ... And one more ...

SELECT DAY(DATEADD(DAY,-1,DATEADD(MONTH,1,DATEADD(DAY,1-DAY(@d),@d)))) AS 'Last
day of the month'

Note: Some of the tips and tricks are subjected to some specific SQL Server
settings hence use them with loads of care.
 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/How%20to%20retrieve%20the%20last%20day%20of%20the%20month%20....%20Or%20Last%20date%20in%20the%20week
		</link>
		<pubDate>Wed, 22 Apr 2009 14:24:31 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ ASP.NET Differences ]]> 
		</title>
		<description>
			<![CDATA[ 
Difference between Convert.ToInt32 and int.Parse
Both(Convert.ToInt32 and
int.Parse) will return the same resule in
most of the cases. But null is handled differently.
Consider the following example&amp;string strCount=&quot;32&quot;;
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount);

If you print the result it will be same ie 32.

If suppose the string is the null (see the example below),
Convert.ToInt32 will return zero.
but the int.Parse will throw ArgumentNullException
error.string strCount=null;
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount); // Error
If you don't assign (initialize) null to the strCount the code will
not compile.
Because in C# variable must be initialized before use.
&quot;Int32&quot; and
&quot;int&quot;
Well, when i searched msn, i found most of the people said
both are same, the only difference is coloring in the IDE.(ha!!). But one guy
from microsoft pointed out one difference that u cannot use Int32 in enum.
which will result in compiler error(Type byte, sbyte, short, ushort, int, uint,
long, or ulong expected). Quite intersting but microsft didn't accept this as
bug, they said it is by design.. This is only with C# and in VB.NET works
fine.
Dataset Vs DataReader




To better improve the
performance of a solution, we have to
understand the DataSet and DataReader and they have to be used correctly in the
places they needed. Let see how they work...

DataReader
Datareader is like a forward only recordset. It fetches one
row at a time so very less Network Cost compare to DataSet(Fetches all the rows
at a time). DataReader is readonly so we cannot do any transaction on them.
DataReader will be the best choice where we need to show the data to the user
which requires no transaction ie reports. Due to DataReader is forward only we
cannot fetch the data randomly. .NET Dataproviders optimizes the datareaders to
handle the huge amount of data.

DataSet
DataSet is always a bulky object that requires lot of memory space compare to
DataReader. We can say the dataset as a small database coz it stores the schema
and data in the application memory area. DataSet fetches all data from the
datasource at a time to its memory area. So we can traverse through the object
to get required data like qureying database.

The dataset maintains the relationships among the datatables inside
it. We can manipulate the realational data as XML using dataset.We can do
transactions (insert/update/delete) on them and finally the modifications can
be updated to the actual database. This provides impressive flexibility to the
application but with the cost of memory space. DataSet maintains the original
data and the modified data seperately which requires more memory space. If the
amount of data in the dataset is huge
then it will reduce the applications performance dramatically.

The following points will improve the performane of a dataset...

1. Don't use the commandbuilder to generate the sql statements.
Though it reduces the development time the query generated

by the command builder will not be always as required. For example
To update the details of an author table the command

builder will generate a query like this ...

Query generated by CommandBuilder UPDATE authors
SET
au_id = ?, au_fname = ?, au_lname = ?, phone = ?,
zip = ?, state = ?, city = ?, address = ?
WHERE
(au_id = ?)
AND (address = ? OR ? IS NULL AND address IS NULL)
AND (au_fname = ?)
AND (au_lname = ?)
AND (city = ? OR ? IS NULL AND city IS NULL)
AND (phone = ?)
AND (state = ? OR ? IS NULL AND state IS NULL)
AND (zip = ? OR ? IS NULL AND zip IS NULL)
But we can write much more efficient query than the above like
this ..UPDATE authors
SET
au_id = ?, au_fname = ?, au_lname = ?, phone = ?,
zip = ?, state = ?, city = ?, address = ?
WHERE
(au_id = ?)
2. Always select the columns required in the quries. Don't use &quot;select * from &amp;lt;table_name&amp;gt;&quot;. Take an example of authors
table which has the author id , name, address, image. For showning the author
name,address if we use select * then the image column also fetched from the
database which requires more memory and NetWork Cost will be more due the
amount of data. This will reduce the applications performance.

3. Always try to use the parameter collection for the stored
procedures. We can execute the stored proceduers in two ways.
a. we can create a string as a query and can execute it.
Ex &quot;getAuthor(7689)&quot;.
b. we can create a command object. Assign the Stored Procedure
name to the commandtext property. Specify the commandtype as stored procedure.
Create a parameter for the value passed to the SP and
execute.
Ex:SqlCommand sqlcmd = new
SqlCommand();
sqlcmd.CommandText=&quot;getAuthors&quot;;
sqlcmd.CommandType= CommandType.StoredProcedure;
SqlParameter sqlparam = new SqlParameter
(&quot;@au_id&quot;,SqlDbType.Int);
sqlparam.Value = 7689;
sqlcmd.Parameters.Add(sqlparam);
sqlcmd.Connection= con;
sqlcmd.ExecuteReader();
There are lot of difference between the way the two quries executed.
The first query will be sent to the database server as a string though we think
we are passing the author id as int. The database server will parse the query
and will determine the datatype of the parameter. This extra processing will
increase the execution time.

But while executing the second query the native datatype of the
parameter is sent to the database server as network packets throuh
RPC.








Difference between Convert.ToInt32 and
int.Parse



Both(Convert.ToInt32 and
int.Parse) will return the same resule in
most of the cases. But null is handled differently.
Consider the following example&amp; string strCount=&quot;32&quot;;
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount);

If you print the result it will be same ie 32.

If suppose the string is the null (see the example below),
Convert.ToInt32 will return zero.
but the int.Parse will throw ArgumentNullException error.
string
strCount=null;
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount); // Error
If you don't assign (initialize) null to the strCount the code will
not compile.
Because in C# variable must be initialized before use.





 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/ASP.NET%20Differences
		</link>
		<pubDate>Thu, 26 Feb 2009 20:59:13 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ Know your IDENTITY ]]> 
		</title>
		<description>
			<![CDATA[ 




Know your
Identity




Â 




Â 
Often we create tables that have identity
columns. An identity column is a special column in SQL Server that can
automatically take on values when an insert operation is done on the table.
What if you want to find out whether a table contains an identity column?? SQL
Server stores this information in the syscolumns table, but you can access this
information in many ways. In this article, we will see the various ways to
access information about whether a table has an identity
column.
Â 
Before we start off with
the methods, let's first create a table that has an identity column, like
this:
Â 
CREATE
TABLE samp_test
(
Â Â Â Â Â Â Â 
colAÂ Â Â  INT IDENTITY,
Â Â Â Â Â Â Â 
colBÂ Â Â  VARCHAR(10)
)
Â 
Â 
Method A
Â 
In the first method, we will fetch this
information from the syscolumns table. This table contains a column
called status
that contains various values.
If the value in this column contains hexadecimal 80, then it means that the corresponding
column contains an identity column. Here is how we can check
this:
Â 
IF (EXISTS
(SELECT name FROM syscolumns WHERE
Â Â Â Â Â Â Â 
OBJECT_NAME(id) = 'samp_test' AND status = 0x80))
Â Â Â Â Â Â Â 
PRINT 'Table has an identity column'
ELSE
Â Â Â Â Â Â Â 
PRINT 'Table does not have an identity column'
Â 
Â 
Method B
Â 
In the second method, we will see whether
a table has an identity column using the COLUMNPROPERTY function. This function takes an
argument IsIdentity
that indicates whether the
column is an identity column. Here is how we can do the check using this
function:
Â 
IF (EXISTS
(SELECT myTemp.IsIdentity FROM
Â Â Â Â Â Â Â 
(SELECT IsIdentity=COLUMNPROPERTY(id, name, 'IsIdentity')
Â Â Â Â Â Â Â Â Â Â Â Â Â Â  FROM syscolumns WHERE OBJECT_NAME(id) = 'samp_test') AS
myTemp
Â Â Â Â Â Â Â 
WHERE myTemp.IsIdentity = 1))
Â Â Â Â Â Â Â 
PRINT 'Table has an identity column'
ELSE
Â Â Â Â Â Â Â 
PRINT 'Table does not have an identity column'
Â 
Â 
This method is slightly convoluted since
the COLUMNPROPERTY function takes the name of the column as the parameter.
Thus, if we want to make a generic sort of a call, we need to iterate through
each column of a table using the syscolumns table and then make a call to the
COLUMNPROPERTY function. Finally we then run an EXISTS check over this derived
table to check for identity.
Â 
Method C
Â 
In the final method, we will use
the OBJECTPROPERTY
function to check whether a
table has an identity column. Here is how we can do the check using this
function:
Â 
IF
(OBJECTPROPERTY(OBJECT_ID('samp_test'), 'TableHasIdentity') =
1)
Â Â Â Â Â Â Â 
PRINT 'Table has an identity column'
ELSE
Â Â Â Â Â Â Â 
PRINT 'Table does not have an identity column'
Â 
Â 
This is the easiest of the lot. The
OBJECTPROPERTY function takes as parameter the name of the object to check (a
table in this case) and then the name of the property. We use the
OBJECT_ID function to get the ID of the object. We
then use the TableHasIdentity property to check if the table has an
identity column. One difference between this method and the others is that this
method does not give the name of the column which is the identity column, which
is possible using the other two methods.




 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/Know%20your%20IDENTITY
		</link>
		<pubDate>Thu, 04 Dec 2008 04:39:11 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ SQL Date Time ]]> 
		</title>
		<description>
			<![CDATA[ 
DECLARE @Date datetime
SET @Date = '2001/08/31'
SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 1),@Date) AS 'First day of the
week'
SELECT DATEADD(dd,-(DATEPART(dw, @Date) - 7),@Date) AS 'Last day of the
week'
SELECT DAY(DATEADD(d, -DAY(DATEADD(m,1,@Date)),DATEADD(m,1,@Date))) AS 'Last
day of the month'

==============================================================================================================
--To get the first day of month and day name by any date
Declare @pInputDate Datetime
set @pInputDate=getdate()- 40
set @pInputDate= CAST(CAST(YEAR(@pInputDate) AS VARCHAR(4)) + '/' +
Â Â Â Â Â Â Â Â Â Â Â Â Â Â  CAST(MONTH(@pInputDate) AS VARCHAR(2)) + '/01' AS DATETIME)
--Will give First date of the month
--Will give day of the date
select @pInputDate AS First_Day_of_mth, datename(dw,@pInputDate) AS
Day_Name
==============================================================================================================
Hi,
Â Â Â Â  here is the Table:
IdÂ Â Â  SaledateÂ Â Â Â Â Â Â Â Â Â Â  Sales
1Â Â Â  2 Jan 2006Â Â Â Â Â Â Â Â Â  100
1Â Â Â  13 Jan 2006Â Â Â Â Â Â Â  200
1Â Â Â  14 Feb 2006Â Â Â Â Â Â Â  300
2Â Â Â  3 Feb 2006Â Â Â Â Â Â Â Â Â  150
2Â Â Â  4 Feb 2006Â Â Â Â Â Â Â Â Â Â  200
3Â Â Â  5 Jan 2006Â Â Â Â Â Â Â Â Â Â  300
3Â Â Â  13 Feb 2006Â Â Â Â Â Â Â Â  400
Â Â Â Â Â Â Â Â  I need the following output?
IdÂ Â Â Â Â Â  JanÂ Â Â Â  FebÂ Â Â Â  MarÂ Â Â  Apr
1Â Â Â Â Â Â Â  300Â Â Â Â  300Â Â Â Â Â  0Â Â Â Â Â Â Â  0
2Â Â Â Â Â Â Â Â  0Â Â Â Â Â Â Â Â  350Â Â Â Â Â  0Â Â Â Â Â Â Â  0
3Â Â Â Â Â Â Â  300Â Â Â Â  400Â Â Â Â Â  0Â Â Â Â Â Â  0

--Here is the result:
SELECT ID, SUM(CASE WHEN MONTH(saledate) = 1 THEN sales ELSE 0 END) AS
'Jan',
Â Â  SUM(CASE WHEN MONTH(saledate) = 2 THEN ISNULL(sales,0) ELSE 0 END) AS
'Feb',
Â Â  SUM(CASE WHEN MONTH(saledate) = 3 THEN ISNULL(sales,0) ELSE 0 END) AS
'Mar',
Â Â  SUM(CASE WHEN MONTH(saledate) = 4 THEN ISNULL(sales,0) ELSE 0 END) AS
'Apr'
FROM sale
GROUP BY ID
--Here it is shown only for 4 months. You can extend this query for complete
year.

-- It gives maximum sales in each month
select id as ID ,
MAX(case when month(saledate) =1 then isnull(sales,0) else 0 end) as 'Jan',
MAX(case when month(saledate) = 2 then isnull(sales,0) else 0 end) as
'Feb',
Max(case when month(saledate) = 3 then isnull(sales,0) else 0 end) as
'Mar',
Max(case when month(saledate) = 4 then isnull(sales,0) else 0 end) as
'Apr',
Max(case when month(saledate) = 5 then isnull(sales,0) else 0 end) as
'May',
Max(case when month(saledate) = 6 then isnull(sales,0) else 0 end) as
'June',
Max(case when month(saledate) = 7 then isnull(sales,0) else 0 end) as
'July',
Max(case when month(saledate) = 8 then isnull(sales,0) else 0 end) as
'Aug',
Max(case when month(saledate) = 9 then isnull(sales,0) else 0 end) as
'Sept',
Max(case when month(saledate) = 10 then isnull(sales,0) else 0 end) as
'Oct',
Max(case when month(saledate) = 11 then isnull(sales,0) else 0 end) as
'Nov',
Max(case when month(saledate) = 12 then isnull(sales,0) else 0 end) as
'Dec'
from sale
group by month(saledate),id
Â 

SELECT
Â Â Â  DAY('5/5/2007'),
Â Â Â  MONTH('5/1/2007'),
Â Â Â  YEAR('5/1/2007'),
Â Â Â  DATEPART(DAY, '1/5/2007'),
Â Â Â  DATEPART(MONTH, '5/1/2007'), Â 
Â Â Â  DATEPART(YEAR, '1/1/2007')
DayÂ Â Â Â Â Â Â Â  MOnthÂ Â Â Â Â Â  yearÂ Â Â Â Â Â Â  datepart_Day datepart_MOnth
datepart_year
======-- ======-- ======-- ======--- ======----- ======----
5Â Â Â Â Â Â Â Â Â Â  5Â Â Â Â Â Â Â Â Â Â  2007Â Â Â Â Â Â Â  5Â Â Â Â Â Â Â Â Â Â Â  5Â Â Â Â Â Â Â Â Â Â Â Â Â  2007

SELECT
Â Â Â  GETDATE() AS local_date,
Â Â Â  GETUTCDATE() AS UTC_date
local_dateÂ Â Â Â Â Â Â Â Â Â Â Â Â  UTC_date
============----- ============-----
2007-05-08 19:12:50.687 2007-05-08 13:42:50.687

SELECT DATEADD(MONTH, 6, GETDATE())AS '6_months_from_now'

6_months_from_now
============-----
2007-11-08 19:12:50.687
==============================================================================================================
declare @datevar datetime
select @datevar = getdate()
/*Example for getdate() : getting current datetime*/
select getdate() [Current Datetime]
/*Example for dateadd : getting date 7 days from current datetime*/
select dateadd(dd, 7, @datevar) [Date 7 days from now]
/*Example for datediff : getting no of days passed since 01-01-2004*/
select datediff(dd,'20040101',@datevar) [No of days since 01-01-2004]
/*Example for datename : getting month name*/
select datename(mm, @datevar) [Month Name]
/*Example for datepart : getting week from date*/
select datepart(wk, @datevar ) [Week No]
/*Example for day : getting day part of date*/
select day (@datevar) [Day]
/*Example for month : getting month part of date*/
select month(@datevar) [Month]
/*Example for year : getting year part of date*/
select year(@datevar) [Year]
/* Getting the Day Name like monday tuesday... */
SELECT DATENAME(dw, GETDATE())
-- or
/* 0-monday,1-tuesday,2-wednesday ....7-monday,8-tuesday... */
SELECT DATENAME(dw, 0)

==============================================================================================================
 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/SQL%20Date%20Time
		</link>
		<pubDate>Thu, 04 Dec 2008 04:28:50 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ Welcome to Shivshanker Page ]]> 
		</title>
		<description>
			<![CDATA[ Wiki is a type of websites. You can edit wiki pages easily.




     You can edit the content with WYSIWYG(HTML)-mode or TEXT-mode or WIKI-mode
     You can change web site style , If SignIn on page top right bottun. 
     Page Lock is signin user only. Lock-@id is @id user only editable. Lock-admin is admin only editable.


 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/Welcome%20to%20Shivshanker%20Page
		</link>
		<pubDate>Thu, 04 Dec 2008 04:27:00 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ ASP Databound ]]> 
		</title>
		<description>
			<![CDATA[  Protected Sub dgSurveys_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles dgSurveys.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim hyp As HyperLink = CType(e.Row.Cells(0).Controls(0), HyperLink)
            Dim url As String = hyp.NavigateUrl
            Dim split1 As String() = url.Split(&quot;?&quot;)
            Dim finalUrl As String = split1(0)
            If split1.Length &gt; 1 Then
                finalUrl &amp;= &quot;?&quot;
                Dim split2 As String() = split1(1).Split(&quot;&amp;&quot;)
                Dim query As String
                Dim isFirstElement As Boolean = True
                For Each query In split2
                    If isFirstElement = False Then
                        finalUrl &amp;= &quot;&amp;&quot;
                    End If
                    If query.Split(&quot;=&quot;).Length &gt; 1 Then
                        finalUrl &amp;= query.Split(&quot;=&quot;)(0) &amp; &quot;=&quot; &amp; Server.UrlEncode(query.Split(&quot;=&quot;)(1))
                    Else
                        finalUrl = finalUrl.Substring(0, finalUrl.Length - 1)
                        finalUrl &amp;= Server.UrlEncode(&quot;&amp;&quot; &amp; query)
                    End If
                    isFirstElement = False
                Next
            End If
            hyp.NavigateUrl = finalUrl

            If DirectCast(e.Row.FindControl(&quot;lblDueCross&quot;), Label).Text = &quot;1&quot; Then
                e.Row.Cells.Item(3).ForeColor = Drawing.Color.Red
            End If
            dgSurveys.DataKeys(e.Row.RowIndex).Item(2).ToString()

            'Dim strKeyword As String = dgSurveys.DataKeys(e.Row.RowIndex).Item(14).ToString
            'If strKeyword = &quot;Gas Warm Air Furnace by Efficiency, State, Configuration Report&quot; Then

            'End If


            Dim tempStr As String = DirectCast(e.Row.FindControl(&quot;lblFreqType&quot;), Label).Text
            ' Code to Disable if the selected company did not fill 
            ' the monthly survey corresponding to the Quarterly survey
            If ChangeDBNullToEmptyString(Right(tempStr, (tempStr.Length - 1)).ToString)  &quot;&quot; Then
                If Left(tempStr, 1) = &quot;2&quot; Then ' Check Whether Survey is Quarterly or not
                    Dim count As Int16
                    Dim t As String = dgSurveys.DataKeys(e.Row.RowIndex).Values(2).ToString
                    Dim strsql As New System.Text.StringBuilder
                    Try
                        strsql.Append(&quot;GetThreeMonthlySurveyID &quot;)
                        strsql.Append(PrepareString(t) &amp; COMMA)
                        strsql.Append(PrepareString(Right(tempStr, (tempStr.Length - 1)).ToString))
                        sqlcmd.CommandTimeout = 1000
                        count = getSingleValue(sqlcmd, strsql.ToString)
                    Catch ex As Exception
                    End Try

                    If count &gt; 0 Then
                        'e.Row.Cells.Item(0).Enabled = False
                        e.Row.Cells.Item(0).Attributes.Add(&quot;style&quot;, &quot;cursor:hand&quot;)
                        Dim txt As String = CType(e.Row.Cells.Item(0).Controls(0), HyperLink).Text
                        e.Row.Cells.Item(0).Controls.Remove(e.Row.Cells.Item(0).Controls(0))
                        e.Row.Cells.Item(0).Text = txt
                        'e.Row.Cells.Item(0).CssClass = &quot;GridGray&quot;
                        e.Row.Cells.Item(0).ForeColor = Drawing.Color.Gray
                        e.Row.Cells.Item(0).Attributes.Add(&quot;onclick&quot;, &quot;alert('Please fill out the corresponding monthly survey first.')&quot;)
                        e.Row.Cells.Item(4).Enabled = False
                        e.Row.Cells.Item(6).Enabled = False
                        e.Row.Cells.Item(5).Text = &quot;Please fill out the corresponding monthly survey first&quot;
                        e.Row.Cells.Item(5).ForeColor = Drawing.Color.Red
                    End If
                End If
            End If
            Dim tblCellControl As System.Web.UI.WebControls.ImageButton = e.Row.Cells.Item(e.Row.Cells.Count - 1).FindControl(&quot;img1&quot;)
            tblCellControl.Attributes.Add(&quot;onclick&quot;, &quot;return getConfirm('Please note that uploading the Excel data will overwrite any data entered in the online form.\nDo you want to proceed?');&quot;)

            'Dim tblCellControl1 As System.Web.UI.WebControls.ImageButton = e.Row.Cells.Item(e.Row.Cells.Count - 1).FindControl(&quot;imgDownload&quot;)
            'tblCellControl1.Attributes.Add(&quot;onclick&quot;, &quot;return excelDownload();&quot;)

        End If
    End Sub ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/ASP%20Databound
		</link>
		<pubDate>Sun, 11 May 2008 19:04:16 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ Links ]]> 
		</title>
		<description>
			<![CDATA[ http://jslint.com/
http://www.glasshaus.com/samplechapters/1051/default.asp
http://www.w3schools.com ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/Links
		</link>
		<pubDate>Tue, 15 Jan 2008 09:43:09 +0000</pubDate>
	</item>
		<item>
		<title>
			 <![CDATA[ SQL UNION, SQL INTERSECT, SQL EXCEPT, SQL EXISTS and SQL CASE for Beginners ]]> 
		</title>
		<description>
			<![CDATA[ 


SQL UNION, SQL INTERSECT, SQL EXCEPT, SQL EXISTS and SQL
CASE for Beginners

Â 
SQL
UNION, SQL
INTERSECT,
SQL EXCEPT, SQL
EXISTS and SQL CASE
Table1Â Â 




Â 


C1


C2




1


A


B




2


A


C




3


A


D




Table2




Â 


C1


C2




1


A


B




2


A


C




3


A


E




SQL
UNION
The purpose of the SQL
UNION command is to combine the results of
two queries together. In this respect,
UNION is somewhat similar to JOIN in that they are
both used to related information from multiple tables. One restriction
of UNION is that all corresponding columns need to be
of the same data type. Also, when using
UNION, only distinct values are selected (similar
to SELECT DISTINCT).
The purpose of the SQL
UNION ALL command is also to combine the
results of two queries together. The difference between UNION
ALL and UNION
is that, while
UNION only selects distinct values,
UNION ALL selects all
values.
The syntax is as
follows:
[SQL Statement
1]
UNION [ALL]
[SQL Statement
2]
Â 
The following are basic rules for combining
the result sets of two queries by using UNION:

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The number and the order of the columns must be the same in all
queries.

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The data types must be compatible.
Â 




SELECT C1,C2 FROM T1
UNION
SELECT C1,C2 FROM T2
Â 


SELECT C1,C2 FROM T1
UNION ALL
SELECT C1,C2 FROM T2




Result:
Â 




Â 


C1


C2




1


A


B




2


A


C




3


A


D




4


A


E






Result:




Â 


C1


C2




1


A


B




2


A


C




3


A


D




4


A


B




5


A


C




6


A


e








Â 
Â 
Â 
SQL
INTERSECT
Similar to the
UNION command,
INTERSECT also operates on two SQL
statements. The difference is that, while
UNION essentially acts as an
OR operator (value is selected if it appears
in either the first or the second statement), the
INTERSECT command acts as an
AND operator (value is selected only if it
appears in both statements). Returns distinct values by comparing the results
of two queries.

INTERSECT
returns any distinct values that are returned by both the query on the left and
right sides of the INTERSECT operand.

The basic rules
for combining the result sets of two queries that use INTERSECT are the
following:

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The number and the order of
the columns must be the same in all queries.

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The data types must be
compatible.
The syntax is as
follows:
[SQL Statement
1]
INTERSECT
[SQL Statement
2]

Â 
SELECT C1,C2 FROM T1
INTERSECT
SELECT C1,C2 FROM T2
Result:




Â 


C1


C2




1


A


B




2


A


C





Note:
INTERSECT
will work only in SQL 2005.


SQL
EXCEPT
The
EXCEPT (MINUS) operates on two
SQL statements. It takes
all the results from the first SQL statement, and then subtract out the ones
that are present in the second SQL statement to get the final answer. If the
second SQL statement includes results not present in the first SQL statement,
such results are ignored.

EXCEPT returns
any distinct values from the left query that are not also found on the right
query.

The basic rules
for combining the result sets of two queries that use EXCEPT are the
following:

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The number and the order of
the columns must be the same in all queries.

Â·Â Â Â Â Â Â Â Â Â Â Â Â  The data types must be
compatible.
The syntax is as
follows:
[SQL Statement
1]
EXCEPT
[SQL Statement
2]
Â 
Â 
SELECT C1,C2 FROM T1
EXCEPT
SELECT C1,C2 FROM T2
Â 
Result:




Â 


C1


C2




Â 
Â 

 ]]> 
		</description>
		<link>
			http://sscheral.atwiki.com/page/SQL%20UNION%2C%20SQL%20INTERSECT%2C%20SQL%20EXCEPT%2C%20SQL%20EXISTS%20and%20SQL%20CASE%20for%20Beginners
		</link>
		<pubDate>Fri, 30 Nov 2007 11:21:28 +0000</pubDate>
	</item>
	

</channel>
</rss>