dbTalk Databases Forums  

Temp table and rollback in SSIS Package

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


Discuss Temp table and rollback in SSIS Package in the microsoft.public.sqlserver.dts forum.



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

Default Temp table and rollback in SSIS Package - 07-09-2008 , 04:56 AM






Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
Quote:
SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
__________|-->Destination connection

+------------+
SQL Task 2|>Create and fill the #temp table
__________|-->Source connection

+------------+
DataFlow 1|>Copy data from first table
__________|-->Both connection, DelayValidation=true, Use #temp, Rollback

+------------+
DataFlow 2|>Copy data from second table
__________|-->Both connection, DelayValidation=true, Use #temp, Rollback

+------------+
SQL Task 3|>Delete data from second table
__________|-->Source connection, DelayValidation=true, Use #temp, Rollback

+------------+
SQL Task 4|>Delete data from first table
__________|-->Source connection, DelayValidation=true, Use #temp, Rollback

+------------+
SQL Task 5|>Log the end of the work
__________|-->Destination connection
Regards.


Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM






Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #3  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #4  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #5  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #6  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #7  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #8  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #9  
Old   
Todd C
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 07:58 AM



Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Quote:
Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

Reply With Quote
  #10  
Old   
Ryo
 
Posts: n/a

Default RE: Temp table and rollback in SSIS Package - 07-09-2008 , 09:01 AM



Thanks for your help.
I have already try this without success, I have an error that said begin
statement of commit can't be found (I will try again to give you the exact
message).
The other problem is that data in destination aren't roll backed with this
method.

"Todd C" wrote:

Quote:
Just curious: If you were to run this using the #temp table but were NOT
concerned about the transactions stuff, does it still run? I thought that
SSIS had some issues with #temp tables but have never tried using them myself.

You might try adding two Execute SQL Tasks before and after the entire set
and set the T-SQL to "BEGIN TRAN" and "COMMIT TRAN" (make sure they are both
connected to the same source, and that the CM is set to
RetainSameConnection=True). No need for a ROLLBACK becuase it will happen
automaticaly on failure.

Keep us posted.

--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Ryo" wrote:

Hi,

I have an SSIS package that use a #temp table to store the list of ID to
compute in different DataFlows and SQL Tasks.
This package has 2 connection managers (OLE DB), Source and Destination.
In order to create the #temp table, RetainSameConnection is set to true on
the Source connection and tasks that use #temp table have DelayValidation set
to true.

The problem is that with RetainSameConnection to true, TransactionOption
must be the same in all the package and I want to rollback some step on
package failure.
Is that somebody knows how to do this?

Here is the detail of the package:

+------------+
|SQL Task 1|>Get the date (passed by user or current by default) and log the
begin of the work
|__________|-->Destination connection
|
+------------+
|SQL Task 2|>Create and fill the #temp table
|__________|-->Source connection
|
+------------+
|DataFlow 1|>Copy data from first table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|DataFlow 2|>Copy data from second table
|__________|-->Both connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 3|>Delete data from second table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 4|>Delete data from first table
|__________|-->Source connection, DelayValidation=true, Use #temp, Rollback
|
+------------+
|SQL Task 5|>Log the end of the work
|__________|-->Destination connection

Regards.

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.