Delete duplicate rows in a table in Sql server

When I am developing I came across to delete duplicate rows in a table. This is solution I have applied. I mentioned it in here coz it may help you.

DECLARE @Table AS TABLE([Id] INT IDENTITY(1 ,1) ,NAME NVARCHAR(50))</code>

INSERT INTO @Table( NAME )

SELECT 'jeevan'

UNION ALL

SELECT 'jeevan'

UNION ALL

SELECT 'Nimal'

UNION ALL

SELECT 'Kuma'

UNION ALL

SELECT 'Kuma'



;WITH cte AS (

SELECT NAME

,ROW_NUMBER() OVER(PARTITION BY C.NAME ORDER BY [Id]) AS [RowId]

FROM   @Table AS C

)


DELETE FROM

FROM   cte

WHERE  [RowId]>1


The remote server returned an error: (417) Expectation failed is solved

what is Expect100Continue Property

       According to w3.org 

The purpose of the 100 (Continue) status  is to allow a client that is sending a request message with a request body to determine if the origin server is willing to accept the request (based on the request headers) before the client sends the request body. In some cases, it might either be inappropriate or highly inefficient for the client to send the body if the server will reject the message without looking at the body.

more details about 100 continue property

I got this error when try to call web method in c#. So finally I salved this error by applying following things.

  1. Adding following statement right before calling web method

 System.Net.ServicePointManager.Expect100Continue = false.

2. Adding following section in web.config inside <configuration>

<settings>
<servicePointManager expect100Continue=”false” />
</settings>

more detail on MSDN