Tuesday, 22 May 2012

How to find Duplicate record And delete from table .?
     Many times you can face problem of duplicate records in table.So How would you identify and delete       duplicate records in a table?
For that Firstly check if table has duplicate records or not using below query.

select [FirstName] from TableName group by  [FirstName] having COUNT(*)>1

Then Delete duplicate records.

Delete from  TableName  where [id] not in (select MAX(id) from  TableName  group by   [FirstName])

Monday, 7 May 2012

ASP.Net menu control


ASP.Net menu control not working in Google Chrome


ASP.Net menu controls breaks in Google Chrome and works fine in other browsers. Here is the hack to make it work in Google Chrome as well,
In C#
      if (Request.UserAgent.IndexOf("AppleWebKit") > 0) 
               Request.Browser.Adapters.Clear(); 
In Vb 
             if (Request.UserAgent.IndexOf("AppleWebKit") > 0) Then
                    Request.Browser.Adapters.Clear()
                    Request.Browser.Adapters.Clear()
                End If


Just add this code on your page load and the menu control will start working fine in Google Chrome as well.

Saturday, 5 May 2012

Sql Server 2008 is going to rock

Here are the top 10 reasons why.


1. In line variable assignment
     Instead of:
            DECLARE @myVar int 
            SET @myVar = 5

   you can do it in one line:
           DECLARE @myVar int = 5

2. Intellisense 
In the SQL Server Management Studio (SSMS).  This has been previously possible in SQL Server 2000 and 2005 with  use of 3rd party add-ins like SQL Prompt ($195).  But  these tools are a horrible hack at best (e.g. they hook into the editor window and try to   interpret what the application is doing). 
     
3. Math syntax like C  
      SET @i += 5.  Enough said.  They finally let a C# developer on the SQL team.