Gridview with Object Data Source Friday, May 19 2006


How to add a Login, Roles and Profiles system Thursday, May 11 2006

Membership/Role Management using Object Data Source Wednesday, May 10 2006 

You can find articles and source code here for membership/role management using Object Data Source/ASP.NET 2.0

Deploying Web Application to Tomcat 4.0 Wednesday, May 10 2006 

Deploying Web Applications to Tomcat by James Goodwill — James Goodwill takes us through the web application deployment process for the Apache Tomcat Web server.

Accessing the different controls inside a GridView control Wednesday, May 10 2006 

Are you curious on how to access label, text box or other controls in Gridview? I have found an article showing all the details. If you are too curious, click here

How to remove duplicate rows from a table in SQL Server Wednesday, May 3 2006 


Microsoft SQL Server tables should never contain duplicate rows, nor non-unique primary keys. For brevity, we will sometimes refer to primary keys as "key" or "PK" in this article, but this will always denote "primary key." Duplicate PKs are a violation of entity integrity, and should be disallowed in a relational system. SQL Server has various mechanisms for enforcing entity integrity, including indexes, UNIQUE constraints, PRIMARY KEY constraints, and triggers.

Despite this, under unusual circumstances duplicate primary keys may occur, and if so they must be eliminated. One way they can occur is if duplicate PKs exist in non-relational data outside SQL Server, and the data is imported while PK uniqueness is not being enforced. Another way they can occur is through a database design error, such as not enforcing entity integrity on each table.

Often duplicate PKs are noticed when you attempt to create a unique index, which will abort if duplicate keys are found. This message is:

Msg 1505, Level 16, State 1 Create unique index aborted on duplicate key.

If you are using SQL Server 2000 or SQL Server 2005, you may receive the following error message:

Msg 1505, Level 16, State 1 CREATE UNIQUE INDEX terminated because a duplicate key was found for object name '%.*ls' and index name '%.*ls'. The duplicate key value is %ls.

This article discusses how to locate and remove duplicate primary keys from a table. However, you should closely examine the process which allowed the duplicates to happen in order to prevent a recurrence.