• Finding Duplicates using SQL

    by Venkata Koppaka | Jan 25, 2010

    Here is a handy script to find duplicates in a table using SQL -

    1 select column, 
    2     count(column) as numofoccurrences 
    3 from table 
    4 group by column 
    5 having count(column) > 1 

    Cheers,

    Venkata

    Go comment!
  • Building my own Blog

    by Venkata Koppaka | Jan 11, 2010

    Over the last few days, I am spending some time to build my own blog. I often feel that a real developer builds his own blog and then blogs using it.:)

    With all these CMS tools , blogging systems I have tried and seen the source code for , I always wanted to write my own blogging system that I can blog and add functionality to my blog whenever I want to in the way I want to - not waiting for a new release for the tool I am using or not waiting for someone to make a change so that I can use it.

    So here I am building my own blog - I will be using .NET 4 and ASP.NET MVC 2 to build my own blog.

    I will be posting a series of blog posts at various stages of development indicating where I am at and my decisions to do a certain task and why I choose that path.

    I am going release a Version 1 of my blog even if it sucks any way on codeplex.

    See you in Build Your Own Blog (BYOB) series soon.

     

    Venkata


    Go comment!
  • Happy New Year 2010

    by Venkata Koppaka | Jan 01, 2010

    I wish everyone a very Happy and Prosperous New Year 2010. :)

     

    Go comment!
  • Update Data in one table with a new or Other table

    by Venkata Koppaka | Dec 14, 2009
    Consider the following scenario - 

    You have data in one table which is old, and then you have data in a newer table which is all good.
    If you have to update the old table with new tables data you can take one of these two approaches

        1. Write a SQL Query that does that
        2. Write a program to iterate and update (ah, I know no one does this except for a purely programming guy who doesn't know any of SQL)

    I am going to focus on writing a SQL Query to update the data - 
    I am going to present you with two ways of writing this query

    Here goes the first one-

    1 update OldTable 
    2 set OldTable.DataToBeUpdated = NewTable.DataToBeUpdated 
    3 from 
    4 OldTable, NewTable 
    5 where 
    6 OldTable.SomeId = NewTable.SomeId 


    And then the second,

    1 update 
    2
    3 select NewTable.DataToBeUpdated as new_value, 
    4        OldTable.DataToBeUpdated as old_value 
    5 from      
    6        OldTable inner join NewTable  on OldTable.SomeId = NewTable.SomeId 
    7 where 
    8       NewTable.DataToBeUpdated is not Null --Some Criteria 
    9
    10 set old_value = new_value; 


    Hope this Helps,
    Cheers
    Venkata


    Go comment!
  • Adding Tooltip to Dropdown List Items

    by Venkata Koppaka | Dec 07, 2009

    Here is a way to add tool tips to items in dropdownlist.

     

    1 //Assuming dropdownLis1 is already Bound.       
    2         foreach (ListItem listItem in dropdownList1.Items) 
    3         { 
    4             listItem.Attributes.Add("title", “tooltip text”); 
    5         } 

    Hope this Helps

    Cheers!!!

    Venkata

    Go comment!