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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 finding duplicates??

Author  Topic 

waitinghyhy
Starting Member

2 Posts

Posted - 2011-06-22 : 13:08:40
Hi I'm very new to SQL Server 2008.

Now I have a table:

ID InsurerID BranchID ClaimNumber PolicyNumber DateOfAccident col
999 Aviva 22 N209 XY-1234 9/1/2010
1001 Aviva 22 N209 XY-1234 9/1/2010 999
1003 AXA 24 A900 XY1234 9/5/2010
1000 Co-op 11 123456789 AB13579 9/6/2010
1002 Co-OP 11 123456789 AB13579 9/6/2010 1000

The original table doesn't have the last column "col", but my ultimate goal is to add this column which has the ID of duplicates.

Does anyone could help me on this?

Thanks

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-06-22 : 13:22:50
please provide yoru sample data as such


declare @insurance table(id int, InsurerID nvarchar(255), BranchID nvarchar(255), ClaimNumber nvarchar(255), PolicyNumber nvarchar(255), DateOfAccident date, col int)

insert into @insurance(ID, InsurerID, BranchID, ClaimNumber, PolicyNumber, DateOfAccident, col)
SELECT 999, 'Aviva', '22', 'N209', 'XY-1234', '9/1/2010', 0
1001 Aviva 22 N209 XY-1234 9/1/2010 999
1003 AXA 24 A900 XY1234 9/5/2010
1000 Co-op 11 123456789 AB13579 9/6/2010
1002 Co-OP 11 123456789 AB13579 9/6/2010 1000


the clearer and thorougher your request the easier you will get help.

If you don't have the passion to help people, you have no passion
Go to Top of Page

waitinghyhy
Starting Member

2 Posts

Posted - 2011-06-22 : 13:37:14
I'm sorry if I didn't state it clear...

declare @insurance table(id int, InsurerID nvarchar(255), BranchID nvarchar(255), ClaimNumber nvarchar(255), PolicyNumber nvarchar(255), DateOfAccident date, col int)

insert into @insurance(ID, InsurerID, BranchID, ClaimNumber, PolicyNumber, DateOfAccident, col)
SELECT 999, 'Aviva', '22', 'N209', 'XY-1234', '9/1/2010',
1001,'Aviva', '22', 'N209', 'XY-1234', '9/1/2010', 999
1003, 'AXA', '24', 'A900', 'XY1234', '9/5/2010'
1000, 'Co-op', '11', '123456789', 'AB13579', '9/6/2010'
1002, 'Co-OP', '11', '123456789', 'AB13579', '9/6/2010', 1000

is this a better way to present my data?

Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2011-06-23 : 16:18:29
what happens when you try it?

what defines duplicate?

If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -