dbTalk Databases Forums  

DataPump problem

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DataPump problem in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nonno Oreste
 
Posts: n/a

Default DataPump problem - 12-09-2003 , 02:29 AM






I have a problem with a DTS package of Sql Server 2000 (Standard Edition).

The package has to import some record from one table to another one and flag
them with a X through a lookup query.
The problem is that sometime DataPump seems to skip some rows, that are not
exported but however flagged with X.
If I manually remove the flag from the table then the row was exported.....

Where is the problem?

Thanks
Daniele

P.S
Sorry for my english.....




Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DataPump problem - 12-09-2003 , 03:36 AM






So you export rows from one SQL Server table to another (same DB ?) and
based on some lookup value you flag them with an "X". Can we have a lok at
the Source Structure? The destination? Some sample data? What is the
Source Query for your datapump? Does it always skip the same rows?

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Nonno Oreste" <dffdfd (AT) dfd (DOT) dfd> wrote

Quote:
I have a problem with a DTS package of Sql Server 2000 (Standard
Edition).

The package has to import some record from one table to another one and
flag
them with a X through a lookup query.
The problem is that sometime DataPump seems to skip some rows, that are
not
exported but however flagged with X.
If I manually remove the flag from the table then the row was
exported.....

Where is the problem?

Thanks
Daniele

P.S
Sorry for my english.....






Reply With Quote
  #3  
Old   
Nonno Oreste
 
Posts: n/a

Default Re: DataPump problem - 12-09-2003 , 04:05 AM




"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> ha scritto nel messaggio
news:enWfSejvDHA.2148 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
So you export rows from one SQL Server table to another (same DB ?)
I export from MSDE to Informix 5.0 through intersolv odbc driver version
3.11

Quote:
based on some lookup value you flag them with an "X".
I use a multiphase datapump

------Row transform function
Function Main()
DTSDestination("partita") = DTSSource("partita")
DTSDestination("numpro") = DTSSource("numpro")
DTSDestination("numset") = DTSSource("numset")
DTSDestination("esercz") = DTSSource("esercz")

Main = DTSTransformStat_OK
End Function

---------On insert success
Function updFlagg()
DTSLookups("udpFlgagg").Execute DTSSource("esercz"),
DTSSource("numset"), DTSSource("numpro"), DTSSource("partita")
updFlagg = DTSTransformStat_OK
End Function

------ DTS lookup query.....
UPDATE Pesate
SET flgagg = 'X'
WHERE (esercz = ?) AND (numset = ?) AND (numpro = ?) AND (partita = ?)

--------DataPump source
select *
from pesate
where flgagg <> 'X' or flgagg is NULL

------- Source table
CREATE TABLE [dbo].[Pesate] (
[esercz] [int] NOT NULL ,
[numset] [int] NOT NULL ,
[numpro] [int] NOT NULL ,
[partita] [int] NOT NULL ,
[classe] [int] NULL ,
[peso] [float] NULL ,
[flgagg] [char] (1) NULL ,
[Orario] [datetime] NULL ,
[Lotto] [nvarchar] (10) NULL ,
[Data] [datetime] NULL ,
[Toelet] [nvarchar] (1) NULL ,
[Ritoel] [nvarchar] (10) NULL
) ON [PRIMARY]

------Destination Table
CREATE TABLE [dbo].[fsuipe] (
[esercz] [decimal] NOT NULL ,
[numset] [decimal] NOT NULL ,
[numpro] [decimal] NOT NULL ,
[partita] [decimal] NOT NULL ,
[classe] [decimal] NULL ,
[peso] [decimal] NULL ,
[flgagg] [varchar] (2) NULL ,
[Orapeso] [varchar](8) NULL ,
[Lotto] [nvarchar] (10) NULL ,
[Dtpeso] [datetime] NULL ,
[Toelet] [varchar] (1) NULL ,
[Ritoel] [varchar] (1) NULL
) ON [PRIMARY]




Quote:
Does it always skip the same rows?
I try to find some likenesses from the rows... the only coincidence is the
time.
In general it happens in the morning from 6.00 to 7.00 and in the afternoon
after 17.00....
Unfortunately, in this period sql server does nothing of unusual.....

Now i have a doubt, can datapump manage a row-by-row process, or it was
implemented only for big data transfer?




Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DataPump problem - 12-09-2003 , 04:44 AM



DTS can do both row by row and BULK.

Make sure this query

select *
from pesate
where flgagg <> 'X' or flgagg is NULL


returns all the rows you think it does

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Nonno Oreste" <dffdfd (AT) dfd (DOT) dfd> wrote

Quote:
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> ha scritto nel messaggio
news:enWfSejvDHA.2148 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
So you export rows from one SQL Server table to another (same DB ?)
I export from MSDE to Informix 5.0 through intersolv odbc driver version
3.11

based on some lookup value you flag them with an "X".
I use a multiphase datapump

------Row transform function
Function Main()
DTSDestination("partita") = DTSSource("partita")
DTSDestination("numpro") = DTSSource("numpro")
DTSDestination("numset") = DTSSource("numset")
DTSDestination("esercz") = DTSSource("esercz")

Main = DTSTransformStat_OK
End Function

---------On insert success
Function updFlagg()
DTSLookups("udpFlgagg").Execute DTSSource("esercz"),
DTSSource("numset"), DTSSource("numpro"), DTSSource("partita")
updFlagg = DTSTransformStat_OK
End Function

------ DTS lookup query.....
UPDATE Pesate
SET flgagg = 'X'
WHERE (esercz = ?) AND (numset = ?) AND (numpro = ?) AND (partita = ?)

--------DataPump source
select *
from pesate
where flgagg <> 'X' or flgagg is NULL

------- Source table
CREATE TABLE [dbo].[Pesate] (
[esercz] [int] NOT NULL ,
[numset] [int] NOT NULL ,
[numpro] [int] NOT NULL ,
[partita] [int] NOT NULL ,
[classe] [int] NULL ,
[peso] [float] NULL ,
[flgagg] [char] (1) NULL ,
[Orario] [datetime] NULL ,
[Lotto] [nvarchar] (10) NULL ,
[Data] [datetime] NULL ,
[Toelet] [nvarchar] (1) NULL ,
[Ritoel] [nvarchar] (10) NULL
) ON [PRIMARY]

------Destination Table
CREATE TABLE [dbo].[fsuipe] (
[esercz] [decimal] NOT NULL ,
[numset] [decimal] NOT NULL ,
[numpro] [decimal] NOT NULL ,
[partita] [decimal] NOT NULL ,
[classe] [decimal] NULL ,
[peso] [decimal] NULL ,
[flgagg] [varchar] (2) NULL ,
[Orapeso] [varchar](8) NULL ,
[Lotto] [nvarchar] (10) NULL ,
[Dtpeso] [datetime] NULL ,
[Toelet] [varchar] (1) NULL ,
[Ritoel] [varchar] (1) NULL
) ON [PRIMARY]




Does it always skip the same rows?
I try to find some likenesses from the rows... the only coincidence is the
time.
In general it happens in the morning from 6.00 to 7.00 and in the
afternoon
after 17.00....
Unfortunately, in this period sql server does nothing of unusual.....

Now i have a doubt, can datapump manage a row-by-row process, or it was
implemented only for big data transfer?





Reply With Quote
  #5  
Old   
Nonno Oreste
 
Posts: n/a

Default Re: DataPump problem - 12-09-2003 , 04:57 AM



Quote:
select *
from pesate
where flgagg <> 'X' or flgagg is NULL
I'm sure, because new row in source table have flag set Null at
default......
You have also to consider that while the dts work, new records can be
inserted in the source table....
In the sorce table are inserted about 6 records for minute......
The strange thing is that the task execution seems to be succesfull.... I
try to log the execution of the datapump in the exception file but no error
message are recorded....




Reply With Quote
  #6  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DataPump problem - 12-09-2003 , 02:24 PM



Then move the records from the live table to a load table at the start of
the package and use that as the source instead. This way you don't care
about records being inserted into the live version. For your update
statement you don't do it anymore in the datapump. You join the load table
back to the live table on the PK val and uodate where they match. You then
clear the load table

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Nonno Oreste" <dffdfd (AT) dfd (DOT) dfd> wrote

Quote:
select *
from pesate
where flgagg <> 'X' or flgagg is NULL

I'm sure, because new row in source table have flag set Null at
default......
You have also to consider that while the dts work, new records can be
inserted in the source table....
In the sorce table are inserted about 6 records for minute......
The strange thing is that the task execution seems to be succesfull.... I
try to log the execution of the datapump in the exception file but no
error
message are recorded....





Reply With Quote
  #7  
Old   
Nonno Oreste
 
Posts: n/a

Default Re: DataPump problem - 12-10-2003 , 02:47 AM



Thanks Allan for your help, you're very kind.
I'll try your solution and then I let you know how it works....

But can you explain me where is the bug in the solution that I devolope?



Reply With Quote
  #8  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DataPump problem - 12-10-2003 , 05:29 AM



What I think you were seeing is that when you initially read the data that
matches your criteria you read it into a rowset. This cannot be changed and
does not reflect new rows being entered into the table that match your
criteria. What you will then see at the end of the datapump is that there
may be rows that meet the criteria which were not updated leading us to
believe that the updating did not work when it actually did.

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Nonno Oreste" <dffdfd (AT) dfd (DOT) dfd> wrote

Quote:
Thanks Allan for your help, you're very kind.
I'll try your solution and then I let you know how it works....

But can you explain me where is the bug in the solution that I devolope?





Reply With Quote
  #9  
Old   
Nonno Oreste
 
Posts: n/a

Default Re: DataPump problem - 12-16-2003 , 02:08 AM



Hi Allan,
I've tried your solution. There is some problem.
Sometimes the last record that i copy are not flagged with 'X' and so the
next run DTS give me an error of duplicate key.....
The Dts are strucured :
1 - I create a temporary table with the non-flagged records
2 - I execute the DataPump to transfer data
3 - I execute the update query:
UPDATE Pesate
SET flgagg = 'X'
FROM
Pesate INNER JOIN Pesate_temp
ON Pesate.esercz = Pesate_temp.esercz
AND Pesate.numset = Pesate_temp.numset AND
Pesate.numpro = Pesate_temp.numpro
AND Pesate.partita = Pesate_temp.partita


Do you have some idea?



Reply With Quote
  #10  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DataPump problem - 12-16-2003 , 02:47 AM



Your procedure should be

1. Take current qualifying rows to Pesate_temp
2. Set Pesate_temp as the SourceObjectName for your DataPump
3. ExecuteSQL task to do the updating of the real Pesate *
4. Clear Pesate_temp

*
From your UPDATE statement it would seem you have a 4 column PK identifier

UPDATE Pesate
SET flgagg = 'X'
FROM
Pesate INNER JOIN Pesate_temp
ON Pesate.esercz = Pesate_temp.esercz
AND Pesate.numset = Pesate_temp.numset
AND Pesate.numpro = Pesate_temp.numpro
AND Pesate.partita = Pesate_temp.partita

If you still get duplicate key violations than is it on the destination as
you pump the data in ?
If yes then is it possible that the key is not actually defined on the
source allowing you to have duplicate values at source?


--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Nonno Oreste" <dffdfd (AT) dfd (DOT) dfd> wrote

Quote:
Hi Allan,
I've tried your solution. There is some problem.
Sometimes the last record that i copy are not flagged with 'X' and so the
next run DTS give me an error of duplicate key.....
The Dts are strucured :
1 - I create a temporary table with the non-flagged records
2 - I execute the DataPump to transfer data
3 - I execute the update query:
UPDATE Pesate
SET flgagg = 'X'
FROM
Pesate INNER JOIN Pesate_temp
ON Pesate.esercz = Pesate_temp.esercz
AND Pesate.numset = Pesate_temp.numset AND
Pesate.numpro = Pesate_temp.numpro
AND Pesate.partita = Pesate_temp.partita


Do you have some idea?





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.