Showing posts with label rows. Show all posts
Showing posts with label rows. Show all posts

Thursday, March 29, 2012

duplicated rows

Hello,

I have a table T1 with fields ID, F1, F2, F3, F4, F5, F6….

I need to find if there is duplicated rows based on F1, F2, F3 columns. If there is set F5='minimum' where ID is MIN(ID). So the smallest should be set as minimum. How can I do this in a stored procedure?

Hi JIM.H:

FYI, here is a quick sampleBig Smile:

create table tbl_testDup (ID int primary key, F1 varchar(50), F2 varchar(50), F3 varchar(50),
F4 varchar(50), F5 varchar(50), F6 varchar(50))


create procedure sp_MarkMin
as
update tbl_testDup set F5='minimum'
where ID in
(select min(ID) from tbl_testDup group by F1,F2,F3)
go

duplicated rows

Hello,

I have a table T1 with fields ID, F1, F2, F3, F4, F5, F6….

I need to find if there is duplicated rows based on F1, F2, F3 columns. If there is set F5=’minimum’ where ID is MIN(ID). So the smallest should be set as minimum. How can I do this in a stored procedure?

You can do something like below (assuming that ID column is unique):

update T1

set F5 = 'minimum'

where ID = (

select min(t.ID)

from T1

group by F1, F2, F3

having count(*) > 1

)

Else you can do below:

update t1

set F5 = 'minimum'

from T1 as t1

join (

select F1, F2, F3, min(t.ID) as min_id

from T1

group by F1, F2, F3

having count(*) > 1

) as t2

on t2.F1 = t1.F1 and t2.F2 = t1.F2 and t2.F3 = = t1.F3

where t2.min_id = t1.ID

|||Thanks, this helps a lot. It seems I need to mark all other rows as
NotMin. Is there a way to mark all the other duplicated rows as SET f5 =
'NotMinimum' if they are not Min(ID), there mgth be more than two rows
duplicated.|||

You can change the 2nd UPDATE stmt to:

update t1

set F5 = 'NotMinimum'

from T1 as t1

join (

select F1, F2, F3, min(t.ID) as min_id

from T1

group by F1, F2, F3

having count(*) > 1

) as t2

on t2.F1 = t1.F1 and t2.F2 = t1.F2 and t2.F3 = = t1.F3

where t2.min_id < t1.ID

Duplicated Rows

Hi,

I have just started developing in SQL Express in the last 2 months so still learning. The problem I’m having with my stored procedure is that I get duplicate rows in my results. The row is a duplicate in terms of column 'Job No' as when the query runs in access only one instance of each 'Job No' is returned but when I recreate the query in SQL server I get a number of rows back for the same 'Job No'? How would I go about getting just 1 instance of each 'Job No' back? With column 'Days to Date' showing the total 'Days to Date' for each Job No. Please see Ms Access results if unsure of what I’m asking.

A copy of the stored procedure is below and a sample of the out-put with Ms Access results at very bottom.

ALTER PROCEDURE [dbo].[sl_DaysDonePerJob] AS

SELECT CASE WHEN [Job No] IS NULL THEN '' ELSE [Job No] END AS [Job No], SUM([Actual Days]) AS [Days to Date], CONVERT(nvarchar(10),MIN(SessionDate),101) AS [Start Date],

CONVERT(nvarchar(10),MAX(SessionDate),101) AS [End Date],

MAX(CASE WHEN DATEPART(MM,SessionDate)=1 THEN 'Jan'

WHEN DATEPART(MM,SessionDate)=2 THEN 'Feb'

WHEN DATEPART(MM,SessionDate)=3 THEN 'Mar'

WHEN DATEPART(MM,SessionDate)=4 THEN 'Apr'

WHEN DATEPART(MM,SessionDate)=5 THEN 'May'

WHEN DATEPART(MM,SessionDate)=6 THEN 'Jun'

WHEN DATEPART(MM,SessionDate)=7 THEN 'Jul'

WHEN DATEPART(MM,SessionDate)=8 THEN 'Aug'

WHEN DATEPART(MM,SessionDate)=9 THEN 'Sep'

WHEN DATEPART(MM,SessionDate)=10 THEN 'Oct'

WHEN DATEPART(MM,SessionDate)=11 THEN 'Nov'

WHEN DATEPART(MM,SessionDate)=12 THEN 'Dec' END) AS 'End Month'

FROM Sessions

GROUP BY [Job No], Sessions.SessionDate

ORDER BY [Job No]

Results in SQL Server Express

'Job No' 'DaystoDate' 'Start Date' 'End Date' 'End Month'

1113-001 0 08/16/2001 08/16/2001 Aug
1113-002 0.5 07/11/2000 07/11/2000 Jul
1113-002 0.5 02/09/2000 02/09/2000 Feb
1116-001 1 07/07/1999 07/07/1999 Jul
1116-001 1 07/06/1999 07/06/1999 Jul
1118-001 1 01/12/1999 01/12/1999 Jan
1118-001 0.5 03/17/1999 03/17/1999 Mar
1118-001 1 02/23/1999 02/23/1999 Feb
1118-001 1 01/26/1999 01/26/1999 Jan
1118-001 0.5 03/09/1999 03/09/1999 Mar
1118-001 1 12/15/1998 12/15/1998 Dec
1118-001 1 02/09/1999 02/09/1999 Feb

Results in Ms Access

Days Done per Job

JobNo

Days to Date

Start Date

End Date

End Month

1113-001

0.00

16/08/2001

16/08/2001

Aug01

1113-002

1.00

09/02/2000

11/07/2000

Jul00

1116-001

2.00

06/07/1999

07/07/1999

Jul99

1118-001

6.00

15/12/1998

17/03/1999

Mar99

Not being an expert by any means, my hunch is that you should set up the first column as a primary key. It will never allow duplicate values after that. It will take you a second to do it in the SQL database table. Right click on the column name in designer. It may not eliminate the problem completely in a sense that there might be a bug in your code that does it. At least you will get an error message from the server protesting the fact that somebody is sending duplicates to it. It will be a cue for you where to look.|||Cheers Alex will give it a go.

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
Thanks
To duplicate the table columns and data, just:
SELECT * INTO Newtable FROM Oldtable
However this will not copy indexes, access privileges, etc.
To get everything you must script the table to create it, and then add the
data, perhaps with
INSERT INTO NewTable SELECT * FROM Oldtable
Of course, using column names instead of * would be a better practice.
Rick Byham (MSFT)
This posting is provided "AS IS" with no warranties, and confers no rights.
"Omar Abid" <omar.abid2006@.gmail.com> wrote in message
news:1181578789.815330.212000@.q69g2000hsb.googlegr oups.com...
> Hi,
> In my program i need to duplicate a table in a current data base.
> I'm thinkin' of reading the data base columns and then rows and so i
> create another table
> Is there any other easy and fast method with SQL Server 2005, because
> my idea is so slow
> I'm using VB 2005 Express with SQL Server 2005 Express
> Thanks
>
|||> INSERT INTO NewTable SELECT * FROM Oldtable
> Of course, using column names instead of * would be a better practice.
And might be necessary, e.g. for IDENTITY/ROWVERSION...
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
ThanksHi
On Jun 11, 5:19 pm, Omar Abid <omar.abid2...@.gmail.com> wrote:
> Hi,
> In my program i need to duplicate a table in a current data base.
> I'm thinkin' of reading the data base columns and then rows and so i
> create another table
> Is there any other easy and fast method with SQL Server 2005, because
> my idea is so slow
> I'm using VB 2005 Express with SQL Server 2005 Express
> Thanks
If you just want to create copy the data then you could use
SELECT *
INTO #temptable
FROM Mytable
Which will create a new table with the contents of the old table, but
the new table will not have the constraints such as primary or foreign
keys and indexes that the original table had. If you dont want the
table but just the columns use a where clause that will never be
satisfied such as
WHERE 1 = 0
Alternatively you can use SMO see Allen Whites posts in the thread
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=876099&SiteID=1
John

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
Thanks
SELECT * INTO NewTable FROM OldTable
Andrew J. Kelly SQL MVP
"Omar Abid" <omar.abid2006@.gmail.com> wrote in message
news:1181578846.356369.101240@.n4g2000hsb.googlegro ups.com...
> Hi,
> In my program i need to duplicate a table in a current data base.
> I'm thinkin' of reading the data base columns and then rows and so i
> create another table
> Is there any other easy and fast method with SQL Server 2005, because
> my idea is so slow
> I'm using VB 2005 Express with SQL Server 2005 Express
> Thanks
>

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
Thanks
Hi
On Jun 11, 5:19 pm, Omar Abid <omar.abid2...@.gmail.com> wrote:
> Hi,
> In my program i need to duplicate a table in a current data base.
> I'm thinkin' of reading the data base columns and then rows and so i
> create another table
> Is there any other easy and fast method with SQL Server 2005, because
> my idea is so slow
> I'm using VB 2005 Express with SQL Server 2005 Express
> Thanks
If you just want to create copy the data then you could use
SELECT *
INTO #temptable
FROM Mytable
Which will create a new table with the contents of the old table, but
the new table will not have the constraints such as primary or foreign
keys and indexes that the original table had. If you dont want the
table but just the columns use a where clause that will never be
satisfied such as
WHERE 1 = 0
Alternatively you can use SMO see Allen Whites posts in the thread
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=876099&SiteID=1
John
sql

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
ThanksOmar Abid <omar.abid2006@.gmail.comwrote in news:1181578579.728121.204320
@.g4g2000hsf.googlegroups.com:

Quote:

Originally Posted by

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
Thanks
>
>


SELECT * INTO NewTable FROM OldTable|||On 11 juin, 18:54, "Chris.Cheney" <Chris.CheneyXXNOSPA...@.tesco.net>
wrote:

Quote:

Originally Posted by

Omar Abid <omar.abid2...@.gmail.comwrote in news:1181578579.728121.204320
@.g4g2000hsf.googlegroups.com:
>

Quote:

Originally Posted by

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
Thanks


>
SELECT * INTO NewTable FROM OldTable


Hi
Thx for your reply I'll try your code and submit the result to you
Omar Abid

Duplicate table

Hi,
In my program i need to duplicate a table in a current data base.
I'm thinkin' of reading the data base columns and then rows and so i
create another table
Is there any other easy and fast method with SQL Server 2005, because
my idea is so slow
I'm using VB 2005 Express with SQL Server 2005 Express
ThanksHi
On Jun 11, 5:19 pm, Omar Abid <omar.abid2...@.gmail.com> wrote:
> Hi,
> In my program i need to duplicate a table in a current data base.
> I'm thinkin' of reading the data base columns and then rows and so i
> create another table
> Is there any other easy and fast method with SQL Server 2005, because
> my idea is so slow
> I'm using VB 2005 Express with SQL Server 2005 Express
> Thanks
If you just want to create copy the data then you could use
SELECT *
INTO #temptable
FROM Mytable
Which will create a new table with the contents of the old table, but
the new table will not have the constraints such as primary or foreign
keys and indexes that the original table had. If you dont want the
table but just the columns use a where clause that will never be
satisfied such as
WHERE 1 = 0
Alternatively you can use SMO see Allen Whites posts in the thread
http://forums.microsoft.com/MSDN/Sh...876099&SiteID=1
John

Duplicate script help

I need to select duplicates from a table into a newly
created table. Here is the script I wrote that was
supposed to select about a million rows and is doing
nothing. Can someone help re-write it please? I am very
poor with scripts writing. Thanks you.
select caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
into temp_tabcases FROM tabCases_new n with (Index =
idx_nnn), Nnn_C_Codes
group BY caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
having count(dlastname) > 1;
What does "doing nothing" mean? Are you getting an error? Getting no rows?
Why are you both grouping by and counting DLastName? Try changing your
HAVING clause to:
HAVING COUNT(*) > 1
It's very difficult to know how to check for duplicates when we don't have
any knowledge of what your table or data look like. Please post DDL (in the
form of a CREATE TABLE statement) and sample data (in the form of INSERT
statements), including some sample duplicate data.
"Bianca Riley" <anonymous@.discussions.microsoft.com> wrote in message
news:4f6b01c473e0$3f6a82f0$a501280a@.phx.gbl...
> I need to select duplicates from a table into a newly
> created table. Here is the script I wrote that was
> supposed to select about a million rows and is doing
> nothing. Can someone help re-write it please? I am very
> poor with scripts writing. Thanks you.
> select caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> into temp_tabcases FROM tabCases_new n with (Index =
> idx_nnn), Nnn_C_Codes
> group BY caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> having count(dlastname) > 1;
|||In addition to what Adam has said, what motivated you to use an Index Hint?
Did you test performance with and without the hint? You may harm performance
if you're forcing the use of a non-covering index. What
clustered/nonclustered indexes do you have and on what columns?
David Portas
SQL Server MVP

Duplicate script help

I need to select duplicates from a table into a newly
created table. Here is the script I wrote that was
supposed to select about a million rows and is doing
nothing. Can someone help re-write it please? I am very
poor with scripts writing. Thanks you.
select caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
into temp_tabcases FROM tabCases_new n with (Index = idx_nnn), Nnn_C_Codes
group BY caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
having count(dlastname) > 1;What does "doing nothing" mean? Are you getting an error? Getting no rows?
Why are you both grouping by and counting DLastName? Try changing your
HAVING clause to:
HAVING COUNT(*) > 1
It's very difficult to know how to check for duplicates when we don't have
any knowledge of what your table or data look like. Please post DDL (in the
form of a CREATE TABLE statement) and sample data (in the form of INSERT
statements), including some sample duplicate data.
"Bianca Riley" <anonymous@.discussions.microsoft.com> wrote in message
news:4f6b01c473e0$3f6a82f0$a501280a@.phx.gbl...
> I need to select duplicates from a table into a newly
> created table. Here is the script I wrote that was
> supposed to select about a million rows and is doing
> nothing. Can someone help re-write it please? I am very
> poor with scripts writing. Thanks you.
> select caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> into temp_tabcases FROM tabCases_new n with (Index => idx_nnn), Nnn_C_Codes
> group BY caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> having count(dlastname) > 1;|||In addition to what Adam has said, what motivated you to use an Index Hint?
Did you test performance with and without the hint? You may harm performance
if you're forcing the use of a non-covering index. What
clustered/nonclustered indexes do you have and on what columns?
--
David Portas
SQL Server MVP
--

Duplicate script help

I need to select duplicates from a table into a newly
created table. Here is the script I wrote that was
supposed to select about a million rows and is doing
nothing. Can someone help re-write it please? I am very
poor with scripts writing. Thanks you.
select caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
into temp_tabcases FROM tabCases_new n with (Index =
idx_nnn), Nnn_C_Codes
group BY caseNo, n.StFips, n.CoFips,Code,
CourtType,
[DataSource],
[DType],
[DLastName],
[DFirstName],
[DMidName],
[DSuffix] ,
[DStAddress] ,
[DApartment] ,
[DCity] ,
[DState],
[DZip] ,
[DTaxID]
having count(dlastname) > 1;What does "doing nothing" mean? Are you getting an error? Getting no rows?
Why are you both grouping by and counting DLastName? Try changing your
HAVING clause to:
HAVING COUNT(*) > 1
It's very difficult to know how to check for duplicates when we don't have
any knowledge of what your table or data look like. Please post DDL (in the
form of a CREATE TABLE statement) and sample data (in the form of INSERT
statements), including some sample duplicate data.
"Bianca Riley" <anonymous@.discussions.microsoft.com> wrote in message
news:4f6b01c473e0$3f6a82f0$a501280a@.phx.gbl...
> I need to select duplicates from a table into a newly
> created table. Here is the script I wrote that was
> supposed to select about a million rows and is doing
> nothing. Can someone help re-write it please? I am very
> poor with scripts writing. Thanks you.
> select caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> into temp_tabcases FROM tabCases_new n with (Index =
> idx_nnn), Nnn_C_Codes
> group BY caseNo, n.StFips, n.CoFips,Code,
> CourtType,
> [DataSource],
> [DType],
> [DLastName],
> [DFirstName],
> [DMidName],
> [DSuffix] ,
> [DStAddress] ,
> [DApartment] ,
> [DCity] ,
> [DState],
> [DZip] ,
> [DTaxID]
> having count(dlastname) > 1;|||In addition to what Adam has said, what motivated you to use an Index Hint?
Did you test performance with and without the hint? You may harm performance
if you're forcing the use of a non-covering index. What
clustered/nonclustered indexes do you have and on what columns?
David Portas
SQL Server MVP
--sql

Tuesday, March 27, 2012

duplicate RPC:Completed events in trace file

Has anyone ever seen duplicate RPC:Completed events in a trace file?
I've got several rows in which the colum values are the exact same. I
was guessing this might be parallel execution, but its just a guess...
thx,
--oj.Hi
I have not seen duplicated events. What version of SQL Server are you using?
What columns/filters are using? Are you logging to screen/file or table?
John
"seraph" wrote:

> Has anyone ever seen duplicate RPC:Completed events in a trace file?
> I've got several rows in which the colum values are the exact same. I
> was guessing this might be parallel execution, but its just a guess...
> thx,
> --oj.
>

duplicate RPC:Completed events in trace file

Has anyone ever seen duplicate RPC:Completed events in a trace file?
I've got several rows in which the colum values are the exact same. I
was guessing this might be parallel execution, but its just a guess...
thx,
--oj.
Hi
I have not seen duplicated events. What version of SQL Server are you using?
What columns/filters are using? Are you logging to screen/file or table?
John
"seraph" wrote:

> Has anyone ever seen duplicate RPC:Completed events in a trace file?
> I've got several rows in which the colum values are the exact same. I
> was guessing this might be parallel execution, but its just a guess...
> thx,
> --oj.
>

duplicate RPC:Completed events in trace file

Has anyone ever seen duplicate RPC:Completed events in a trace file?
I've got several rows in which the colum values are the exact same. I
was guessing this might be parallel execution, but its just a guess...
thx,
--oj.Hi
I have not seen duplicated events. What version of SQL Server are you using?
What columns/filters are using? Are you logging to screen/file or table?
John
"seraph" wrote:
> Has anyone ever seen duplicate RPC:Completed events in a trace file?
> I've got several rows in which the colum values are the exact same. I
> was guessing this might be parallel execution, but its just a guess...
> thx,
> --oj.
>

duplicate rows?

hi all..
how will i fetch duplicate rows in a table i want the count also
eg in my table if the same company name exist morethan once i want to fetch it
thnks in advance
Jagduplicate rows is not the same thing as multiple rows with the same value in a particular column

presumably if your table has a primary key, you will never have a duplicate row

for your question about company names, try this --select companyname
, count(*) as rows
from daTable
group by companyname
having count(*) > 1|||u r right
its not duplicate its multiple nd thnks for ur querysql

duplicate rows in drill down

Hi all,
I have a report that drills down some, and is showing duplicate rows.
How can remove the duplicate rows? Cannot do this on the initial sp because
they are not duplicates.
do I need to have an DISTINCT expression in there?
thanks
gvTry doing "Hide duplicate" from the textbox. Usually this works.
Amarnath
"gv" wrote:
> Hi all,
> I have a report that drills down some, and is showing duplicate rows.
> How can remove the duplicate rows? Cannot do this on the initial sp because
> they are not duplicates.
> do I need to have an DISTINCT expression in there?
> thanks
> gv
>
>|||ok
thanks!!
gv
"Amarnath" <Amarnath@.discussions.microsoft.com> wrote in message
news:81D8952B-BA27-4301-95B4-02EFFF199D52@.microsoft.com...
> Try doing "Hide duplicate" from the textbox. Usually this works.
> Amarnath
> "gv" wrote:
>> Hi all,
>> I have a report that drills down some, and is showing duplicate rows.
>> How can remove the duplicate rows? Cannot do this on the initial sp
>> because
>> they are not duplicates.
>> do I need to have an DISTINCT expression in there?
>> thanks
>> gv
>>|||not working!!
there is 7 testboxes for each row in the group?
only hides duplicates of the one textbox. Need to not show duplictes of the
whole row?
thanks
gv
"Amarnath" <Amarnath@.discussions.microsoft.com> wrote in message
news:81D8952B-BA27-4301-95B4-02EFFF199D52@.microsoft.com...
> Try doing "Hide duplicate" from the textbox. Usually this works.
> Amarnath
> "gv" wrote:
>> Hi all,
>> I have a report that drills down some, and is showing duplicate rows.
>> How can remove the duplicate rows? Cannot do this on the initial sp
>> because
>> they are not duplicates.
>> do I need to have an DISTINCT expression in there?
>> thanks
>> gv
>>|||In a drill down it is tricky to have this, anyways, If possible can you bring
it from query using distinct.
Amarnath
"gv" wrote:
> not working!!
> there is 7 testboxes for each row in the group?
> only hides duplicates of the one textbox. Need to not show duplictes of the
> whole row?
> thanks
> gv
>
> "Amarnath" <Amarnath@.discussions.microsoft.com> wrote in message
> news:81D8952B-BA27-4301-95B4-02EFFF199D52@.microsoft.com...
> > Try doing "Hide duplicate" from the textbox. Usually this works.
> >
> > Amarnath
> >
> > "gv" wrote:
> >
> >> Hi all,
> >>
> >> I have a report that drills down some, and is showing duplicate rows.
> >> How can remove the duplicate rows? Cannot do this on the initial sp
> >> because
> >> they are not duplicates.
> >>
> >> do I need to have an DISTINCT expression in there?
> >>
> >> thanks
> >> gv
> >>
> >>
> >>
>
>

duplicate rows in 1 csv file

Hi, I am trying to import data from a csv files to a OLE DB Destination. The csv files contains all transactional changes . For example for a particular record the firstname, lastname, email address records change within the same csv file. I need to save only the last updated record from the csv files. I have tried "slowly changing dimensions" but these dont work when there is duplictes within the same csv file. Also have tried 'Sort' but this only stores the first occurance.
Any ideas how i can store the latest changed data within 1 csv file.

How does the process distinguish between the latest data and duplicate data?

Is there a date as part of the row or is it just the last row wins?

Kirk Haselden
Author "SQL Server Integration Services"

|||the last row wins. there is no timestamp field . This is the way designed by the third party developers. Records are saved in csv files as changes are made. I have to put all these rows of data into a datawarehouse without duplicating the primary key.

duplicate rows but no key on the tables

Dear All,

I have a table with 10 billion records but there are no key on it. I cannot
build a key on it as it is the data source.

However, the data source exits the duplicated rows.

I have used the DTS to transform the data into a new table and delete the
duplicated rows. As there are 10 billion records, i need to divide it into 3
parts and also the process lasts for 6 hours each part.

I want to ask is there any other good methods to slove my problem??

Thx

Estheresther s via SQLMonster.com (forum@.SQLMonster.com) writes:
> I have a table with 10 billion records but there are no key on it. I
> cannot build a key on it as it is the data source.
> However, the data source exits the duplicated rows.
> I have used the DTS to transform the data into a new table and delete
> the duplicated rows. As there are 10 billion records, i need to divide
> it into 3 parts and also the process lasts for 6 hours each part.
> I want to ask is there any other good methods to slove my problem??

Eliminating duplicates from 10 milliard(*) rows is nothing for the
impatient. I'm happy that I don't have to play that game.

(*) I assume. 10 billion rows as in what I mean with billion would be
really dauting...

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Duplicate Rows Blues

Hello,
I would like to prevent Contacts being inserted into the database when inserted Contact:

firstname + ', ' + lastname + ', ' + workphone

is identical with existing Contacts:

firstname + ', ' + lastname + ', ' + workphone

Can this be done with an Insert Trigger and if so, how? Thank you in advance,
LarsYou could add an alternate key to the entity on those attributes. In your physical implementation, add a "UNIQUE" constraint and a unique index on those columns. It could be done with a trigger, but it will probably not preform as well.|||I'll second that recommendation. A UNIQUE constraint should be more efficient (and simpler) than any trigger you could write.

-PatPsql