Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3345954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:14:47+00:00 2026-05-18T01:14:47+00:00

I have a single table in the Sql Server 2008 r2 DB. Every few

  • 0

I have a single table in the Sql Server 2008 r2 DB. Every few seconds I import data into this table. At one point, the import was failing, so it was constantly importing the same data, creating duplicates. (basically, if the import read 20 lines, imported 19 and failed on 20 .. then those 19 were not in a transaction .. and thus got inserted).

Anyways, I’m trying to figure out how I can I remove all the duplicates and just the first (original) inserted row?

Here’s the table schema – and please note that there’s a few nullable fields.

CREATE TABLE [dbo].[LogEntries](
    [LogEntryId] [int] IDENTITY(1,1) NOT NULL,
    [GameFileId] [int] NOT NULL,
    [CreatedOn] [datetimeoffset](7) NOT NULL,
    [EventTypeId] [tinyint] NOT NULL,
    [Message] [nvarchar](max) NULL,
    [Code] [int] NULL,
    [Violation] [nvarchar](100) NULL,
    [ClientName] [nvarchar](100) NULL,
    [ClientGuid] [nvarchar](50) NULL,
    [ClientGuidReversed] [nvarchar](50) NULL,
    [ClientIpAndPort] [nvarchar](50) NULL,
 CONSTRAINT [PK_LogEntries] PRIMARY KEY CLUSTERED 
(
    [LogEntryId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

Cheers 🙂

UPDATE: What are Duplicates (in this case?)

Damn sorry. forgot to define a duplicate.
The LogEntryId is unique, so ignore that piece of info (it’s not imported). all the rest of the data is imported. Here’s two rows of data that are identical.

6459749 39  2010-11-05 00:00:25.0000000 +11:00  6   Violation (MULTIHACK) #70805    70805   MULTIHACK   angelb  aeda202c22ed41f7301d0673647c55d8    8d55c7463760d1037f14de22c202adea    220.246.157.194:57133
6459766 39  2010-11-05 00:00:25.0000000 +11:00  6   Violation (MULTIHACK) #70805    70805   MULTIHACK   angelb  aeda202c22ed41f7301d0673647c55d8    8d55c7463760d1037f14de22c202adea    220.246.157.194:57133

and to compare this to the top 5 ordered by desc

6505931 40  2010-11-08 23:39:16.0000000 +11:00  4   NULL    NULL    NULL    Zaphrolio   69ae1bfea616c244e5c223e51d5ceb8e    e8bec5d15e322c5e442c616aefb1ea96    175.38.209.80:10000
6505930 39  2010-11-08 23:39:04.0000000 +11:00  3   NULL    NULL    NULL    imBakedAsBro    8cf1b3b6a389229fa4adeec07dc087ce    ec780cd70ceeda4af922983a6b3b1fc8    110.175.83.45:10000
6505929 39  2010-11-08 23:39:03.0000000 +11:00  2   NULL    NULL    NULL    imBakedAsBro    NULL    NULL    110.175.83.45:10000
6505928 80  2010-11-08 23:39:04.0000000 +11:00  4   NULL    NULL    NULL    Asmo74  5ccf5ee85a6cf08da563bdcbfe75351d    d15357efbcdb365ad80fc6a58ee5fcc5    61.68.212.231:50273
6505927 80  2010-11-08 23:39:03.0000000 +11:00  4   NULL    NULL    NULL    McJellyfish c48218542918bec900a331a81e0a9d05    50d9a0e18a133a009ceb81924581284c    60.225.3.2:10000
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:14:47+00:00Added an answer on May 18, 2026 at 1:14 am
    with cte as (
     select row_number() over (
       partition by  
          [GameFileId]
        , [CreatedOn]
        , [EventTypeId]
        , [Message]
        , [Code]
        , [Violation]
        , [ClientName]
        , [ClientGuid]
        , [ClientGuidReversed]
        , [ClientIpAndPort]
     order by [LogEntryId]) as rn
     from LogEntries)
    delete from cte
     where rn > 1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a single entry output from a paradox table which is imported into
I have an SQL Server 2008 database, which contains about 40 tables. Most of
I am using SQL Server 2008 Enterprise. I have tried that if I set
I have added Full Text Search to my sql server 2008 express database and
Ok, using SQL Server 2008. On my web page I have a textbox with
I have dbml with single table users i want add partial class for User
I have a form that searches all rows in a single table (TServices) that
I have a fairly huge database with a master table with a single column
Say I have a table called xml that stores XML files in a single
I have 2 tables: 1. Employees 2. Vouchers Employees table has a single primary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.