Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 import data-duplicate problem

Author  Topic 

constantinos1987
Starting Member

25 Posts

Posted - 2008-11-18 : 20:01:04
i am trying to import some data to a new dbo
the import file has 9 columns. i need only the 6 of them
deleting the columns 7,8 & 9 i have 6 columns but with a lot of duplicate records and it is a huge file.....

for example....

672935,54866,374,2,2004-02-27 17:06:00,True,0000000012558,1,1.49
672935,54866,374,2,2004-02-27 17:06:00,True,0000000013142,1,1.1799999
672935,54866,374,2,2004-02-27 17:06:00,True,0000000037239,1,1.38999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000002013,1,1.22
672936,55123,374,1,2004-05-07 08:38:00,True,0000000003043,2,0.81999999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000022976,1,1.399999
672936,55123,374,1,2004-05-07 08:38:00,True,0000000101276,1,1.600000
672937,55724,374,2,2004-08-05 08:53:00,True,0000000001033,1,3.890000
672937,55724,374,2,2004-08-05 08:53:00,True,0000000019220,1,5.129999

after the delete....

672935,54866,374,2,2004-02-27 17:06:00,True
672935,54866,374,2,2004-02-27 17:06:00,True
672935,54866,374,2,2004-02-27 17:06:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672936,55123,374,1,2004-05-07 08:38:00,True
672937,55724,374,2,2004-08-05 08:53:00,True
672937,55724,374,2,2004-08-05 08:53:00,True

is there any way to fix this duplicate problem???

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-18 : 22:44:00
select * from
(select row_number() over (partition by col4 order by col4) as seq,* from
table)t
where t.seq=1
Go to Top of Page
   

- Advertisement -