Avatar of Collezione
Collezione
 asked on

Remove Duplicate Rows

Hi folks,
I have a database table named TSALES7_V2.How can I remove duplicate rows of this table? Is it possible reduce the repetiton number to one? I need just one of these duplicated rows..
Please help
my table looks like this:
CREATE TABLE [dbo].[TSALES7_V2] (
      [D_DATE5] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DCURR] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [DORGAN] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DVERSION] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DYIL] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DSEZON] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DCT] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DURUNTIP] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DTERMIN] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [DSES] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [DKUMAS] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [DCINS] [varchar] (72) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [MODEL] [int] NULL ,
      [SATMIK] [int] NULL ,
      [SATTUT] [float] NULL ,
      [INDIRIM] [float] NULL ,
      [ORTFYT] [float] NULL ,
      [BRSATTUT] [float] NULL ,
      [HEDEF] [float] NULL ,
      [StatusFlag] [bit] NULL ,
      [VALUE] [float] NULL ,
      [Cinsiyet] [char] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Daciklama] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
Microsoft SQL Server 2005

Avatar of undefined
Last Comment
chapmandew

8/22/2022 - Mon
chapmandew

easy way to do it:

select distinct * into NewTable from tsales7_v2

truncate table tsales7_v2

insert into tsales7_v2  
select * from NewTable
ASKER CERTIFIED SOLUTION
Aneesh

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Collezione

ASKER
No :(
there are still duplicate rows..How can I do this by considerind primary key columns? Because my final purpose is inserting unique rows to another table..
Aneesh

Did u check the link i sent ?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Collezione

ASKER
I have 8 primary key columns and unfortunately I could not get the unique rows yet..And I have checked it :(
chapmandew

That is the thing....if you used distinct then there is no way there are duplicate row values.  

What columns make up the primary key?