Category Archives: Development

Removing duplicates from SQL Server 2005

I am currently working on project that is required to remove duplicate entries from Facility table, duplicates are based on address and city being the same. The duplicates would be recorded into an excel file for further examination and later … Continue reading

Posted in Development | Tagged | Leave a comment

SQL Server 2005 Query XML data stored in ntext field

We moved from SQL 2000 to SQL 2005 so we are still storing the XML data in ntext field. Finally I need to mine the XML content and I thought cool let me write some XPath queries and be done … Continue reading

Posted in Development | Tagged | 1 Comment

C# Delegate Covariance and Contra-variance

Covariance allows us to have a more derived type as return type Contra-variance allows us to have less derived type as parameter type than what is specified in the delegate. Example: using System; using System.Collections.Generic; public class MyBase { public … Continue reading

Posted in Development | Leave a comment

C# Anonymous Methods and Lambda Expressions

In the following example talks about anonymous methods, method group conversions and finally lambda expressions. using System; using System.Collections.Generic; public class CarEventArgs : EventArgs { public string Msg { get; set; } public CarEventArgs(string msg) { Msg = msg; } … Continue reading

Posted in Development, Uncategorized | Tagged | Leave a comment

Using the SQL 2005 Pivot Clause

Let’s say you are querying interview table for the interview id 488 Lets say we are only interested in these 3 disease specific fields Lets get the interview values for the above fields along with the values from the interview … Continue reading

Posted in Development, Uncategorized | Tagged , | Leave a comment

using Enums as data source for a drop down list box in asp.net

We can discuss the merits of using enums as data sources at a different time. But I needed to use an enum as datasource and wanted to have a space in one of the enum values. The article by Luke … Continue reading

Posted in Development | Tagged | 1 Comment

Add Column with a check on acceptable range of values

Here is the code to add a new column to an existing table with a check on range. The following column only allows values of 0,1 or 2. IF NOT EXISTS (SELECT c.name FROM dbo.sysobjects s INNER JOIN dbo.syscolumns c … Continue reading

Posted in Development | Tagged | Leave a comment