Archive

Archive for May, 2011

Remove duplicate rows from a table in SQL Server

May 12, 2011 Leave a comment

Hello Friends,

I have tried to remove the duplicate rows from the table using row_number function. Here I am explaining the demo using the temp table.

Steps:

1. Create Temp Table or Select your table

Create Table #Main

(

id int,

item varchar(100)

)

2. Insert some records

insert into #main values (119,1)

insert into #main values (119,2)

insert into #main values (119,2)

insert into #main values (119,3)

insert into #main values (119,3)

insert into #main values (119,4)

insert into #main values (119,5)

insert into #main values (119,6)

insert into #main values (119,7)

insert into #main values (119,8)

insert into #main values (119,8)

insert into #main values (119,8)

3. expected Output

–Output

–119 1

–119 2

–119 3

–119 4

–119 5

–119 6

–119 7

–119 8

4. first we have start to get single records

–we got those record which count =1

select id,item from

(

select *,

(select count(item) as NoOfCount from #Main where item =Mst.Item group by id,item) as NCount

from #Main Mst

)a

where NCount =1

5. Result 1

–Result

–119  1

–119  4

–119  5

–119  6

–119  7

6. Now find the records where item count is >1

–we got those record which count >1

select id,item from

(

select id,item,ROW_NUMBER()Over(Partition by Item Order by Item) As Rep

from

(

select *,

(select count(item) as NoOfCount from #Main where item =Mst.Item group by id,item) as NCount

from #Main Mst

)a where NCount>1

)RepT where rep=1

7. Result 2

–Result

–119  2

–119  3

–119  8

8. Result 1 Union Result 2

9. Output

–Result

–119  1

–119  4

–119  5

–119  6

–119  7

–119  2

–119  3

–119  8

Thanks,

Http://www.ibusiness-management.com

Outlook blocked access to the following potentially unsafe attachments

May 11, 2011 Leave a comment

Hello Friends,

I have come across the problem when I getting the .chm extension in my mail.

I have found the solution which is below.

Steps:

  1. Exit Outlook if it is running.
  1. Click Start, and then click Run. Copy and paste (or type) the following command in the Open box, and then press ENTER:

              regedit

  1. Verify that the following registry key for your version of Outlook exists.
    Microsoft Office Outlook 2010

HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security

             Microsoft Office Outlook 2007

HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security

             Microsoft Office Outlook 2003

             HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Security

             Microsoft Outlook 2002

             HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Security

             Microsoft Outlook 2000

             HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Security

             If the registry key exists, go to step 5.

             If the registry key does not exist, follow these steps to create it:

    1. Locate, and then click the following registry key:

HKEY_CURRENT_USER\Software\Microsoft

    1. Under Edit, click New, and then click Key.
    2. Type Office, and then press ENTER.
    3. Under Edit, click New, and then click Key.
    4. For Outlook 2010, type 14.0, and then press ENTER.
      For Outlook 2007, type 12.0, and then press ENTER.
      For Outlook 2003, type 11.0, and then press ENTER.
      For Outlook 2002, type 10.0, and then press ENTER.
      For Outlook 2000, type 9.0, and then press ENTER.
    5. Under Edit, click New, and then click Key.
    6. Type Outlook, and then press ENTER.
    7. Under Edit, click New, and then click Key.
    8. Type Security, and then press ENTER.
  1. Under Edit, click New, and then click String Value.
  1. Copy and paste (or type) the following name for the new value:

Level1Remove

  1. Press ENTER.
  1. Right-click the new string value name, and then click Modify.
  1. Type the file name extension of the file type that you want to open in Outlook. For example:

.exe

To specify multiple file types, use the following format:

.exe;.chm

  1. Click OK.
  1. Exit Registry Editor.
  1. Restart your computer.

Thanks.

http://www.ibusiness-management.com

Reference Site:

http://support.microsoft.com/kb/829982

Categories: Uncategorized
Follow

Get every new post delivered to your Inbox.

Join 244 other followers