Multiple Transactions Not Working In Package
Jan 13, 2006
I have a package with two sequence containers, each containing two SQL tasks and a data flow task, executed in that order. I want to encapsulate the data flow task in a transaction but not the SQL tasks. I have the TransactionOption property set to 'required' on the data flow tasks and 'supported' on the SQL tasks and the sequence containers. When I run the package I get a distributed transaction error on the first SQL task of the second sequence container:
"[Execute SQL Task] Error: Executing the query "TRUNCATE TABLE DistTransTbl2" failed with the following error: "Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."
The only way I can get the package to succeed is to set the TransactionOption = 'required' on the sequence containers and 'supported' on all subordinate tasks. This is not what I want, however. Any ideas?
Thanks,
Eric
View 4 Replies
ADVERTISEMENT
May 2, 2007
I have a package that has a container containing multiple DF Tasks.
The container is set to be Transacted, such that should any of the DF tasks fail the data inserted in any of the previous tasks rolls back.
This works as expected.
However, this container is part of a larger package and so I wanted to have a checkpoint on it, so that should any of the tasks within it fail, the package could be restarted from this container.
However, I would expect the functionality to be that on failure, the checkpoint would cause the whole container to be started again (because the container is transacted all DF task info would be rolled back) so we would expect it to start at task 1 again.
This is not the functionality I see. The package restarts from the failed task within the container every time.
According to the book Prof SSIS, it should start again from the first task and as explained this makes sense on a Transacted container as you would want this to happen.
A previous forum message encountered the same issue it appears:
See SSIS Checkpoints 04 Dec 2006.
This is an extract from it:
"I only experimented a little but my experience was that when I have a transacted container with multiple tasks that are checkpointed, SSIS would try to restart from the task that failed rather than from the first task in the container. The transaction was being rolled back correctly though.
In short, I felt that check points were not aware of transactions.
So, I ended up with this setting and it works for me:
Container is checkpointed and trasacted.
Tasks within the container are not checkpointed.
'FailParentOnFailure' property set to True on the tasks.
That way, if a task failed, it would fail the container and a checkpoint would be created at that level. Transaction would be rolled back as usual."
While this makes sense to me it is not the same properties that the SSIS book has that work.
Additionally, this didn't work for me either !!
I have tried every combination of FailPackageOnProperty and FailParentOnProperty that makes sense but every time the package restarts from the failed container within the task.
The transaction is rolled back correctly every time, but it seems the checkpoint that is created is not used correctly when dealing with transactions within containers.
View 1 Replies
View Related
Oct 31, 2006
I am writing a fairly complex data automation procedure that basically uses about 5 stored procedures and some additional sql from C# to populate a database. i would like to utilize transactions in C# and sql to help me if something goes wrong. My question is, do i have to maintain the same connection in order to have one transaction for all my Commands. right now i do things like connection.Open();Command.ExecuteNonQuery(); connection.Close(); connection.Open();Command2.ExecuteNonQuery(); connection.Close(); i think i have to keep the same connection open for the duration of all my commands in order to utilize transactions, is this correct? thanks, mcm
View 5 Replies
View Related
Oct 10, 2007
Greetings,
I have a requirement from the client that specifies to rollback every insert/update that happenned in the package if any task (control or data flow) fails.
I'm certain the SSIS package-level transactions take care of this, however, in this package, there is an OLE DB Transformation that executes a stored procedure which has a transaction in itself.
so to draw a quick picture...
Package
{
Transaction1
{
Data Flow
{
OLE DB Transformation
{
Stored Procedure
{
Transaction2
{
}
}
}
}
}
}
Here's my question:
What would happen if an error occured in the stored procedure (Transaction2)?
Does it behave like SQL Server 2005 where, given a scenario of nested transactions, the innermost transaction is comitted and the outermost transaction is rolled back?
I'm hoping that if the stored procedure decides to rollback Transaction 2 via error handling or if an SQL error occurs that I can rollback Transaction 2 and log an entry in the audit log.
View 1 Replies
View Related
Apr 12, 2006
I want to use transactions to protect my tasks. I have ten tasks that need to be completed in a single package. If any of the tasks fail - I need the entire process to rollback.
I have 5 execute sql tasks to truncate groups of tables in my destination database.
After each of the single truncate tasks - I use data flow tasks to copy the data from the source to the destination db.
Both dbs are on the same server.
I am basically copying the entire db - with the exception of a few tables.
package.transactionOption = required ,
and all tasks transactionOptions are set to supported.
Several questions. It seems to hang on the first data flow task - the output window stops, etc.
If I set package.transactionOption = supported - The package will execute.
If I create an error on the thrid truncate task - all previous tasks will complete - the package will fail on step 3 and the truncation for this step is not commited.
I am partially there. Can anyone help point me in the right direction? I need the entire process to commit if all tasks are successful or rollback if any fail.
thank-you in advance
Kim
View 1 Replies
View Related
Dec 7, 2007
I have a simple question: Can I have two or more stored procedures that begin transactions but the last stored procedure will commit all transactions if there was no error?
In other words, I have a stored procedure that performs some legacy stuff. I do not want to rewrite that logice, execpt I am putting it into a Stored Procedure since it currently is embedded SQL.
To support newer functionality, I am writing data to additional new tables. However, I do not want the *new* things to occur if there is an error. This is easy enough, I dont call the Stored Procedure for the new functionality if there was an error. However, if there was not an error and the newer stored procedure is called AND there is an error in the new stored procedure, I want to ROLLBACK the changes from the proceeding stored procedures.
To my understanding, I can name transactions but that is only to indicate in the logs what transactions have failed.
I thought about not using transactions for any of the individual stored procedures and calling them from a main stored procedure. The main stored procedure will have a BEGIN TRY and an END TRY (I am using SQL Server 2005) and at the top (right after the try) I will have a BEGIN TRANSACTION. In the BEGIN CATCH I will have a ROLLBACK and at the end I will have a COMMIT. If any of the stored procedures fail at any point it will cause the catch to occur thus rolling back all of my transactions. This would be the easiest way but I still need to deal with the question of, "What happens if any single stored procedure is called?" I guess I could have try and catches in each individual stored procedure for that.
I just want to make sure I am not overlooking something simple. I think I have the right idea by doing it this way I mentioned above. Because this is critical billing processing I just want to have some reassurance that this would work.
Thank
View 4 Replies
View Related
Apr 4, 2013
I have a stored proc that is executed from within another stored proc, both of these procs run transactions in them that update data.
Now if either of these 2 SPs fail i want to be able to roll back the transactions that have occured so that the data doesn't change.
View 5 Replies
View Related
Apr 30, 2008
am trying to generate the same batch id for the records that I am trying to insert..
for example,
I have 3 records
1001
1002
1004
and I want to insert with the same batch id starts with 1
batchid id
1 1001
1 1002
1 1003
and next tiem i insert with new records
1005
1008
1009
and i insert with an incremented batch id which is 2
batch id id
2 1005
2 1008
2 1009
how can i generate the same batch id for each transaction?
View 2 Replies
View Related
Jan 3, 2008
I am using ODBC to connect to SQL Server. The documentation says that ODBC transactions are managed on the connection level and cannot span connections.
Does this mean that two instances of my code using transactions (each with its own process and a single connection) in the same machine accessing the same database will not play nice together (violate transaction rules)?
Thanks
View 3 Replies
View Related
Apr 4, 2008
Hi All,
We have a SSIS package where we have implemented a cursor in Execute SQL Task.
Immediately after this Execute SQL Task, we have a Data Flow Task.
The package was running absolutely fine until we changed the Transaction property of the Package to "Required".
The Transaction property for all the tasks in the Control Flow is set to "Supported".
Now, after the execution of the Execute SQL Task containing the cursor, the Data Flow Task becomes "yellow", but, does not execute. The package then gets stuck at this point and does not execute any further.
Anybody has encountered such a problem with Transactions in SSIS?
Thanks in advance.
Regards,
B@ns.
View 1 Replies
View Related
Jul 23, 2005
Hi,I'm having a problem running a distributed transaction between twolinked servers that both have multiple instances of SQL Serverinstalled on them. This is the error message that I receive:"The operation could not be performed because the OLE DB provider'SQLOLEDB' was unable to begin a distributed transaction.[OLE/DB provider returned message: New transaction cannot enlist in thespecified transaction coordinator. ]OLE DB error trace [OLE/DB Provider 'SQLOLEDB'ITransactionJoin::JoinTransaction returned 0x8004d00a]."The query follows the format:"BEGIN DISTRIBUTED TRANUPDATE [LINKEDSERVER1INSTANCE_NAME].DB.OWNER.TABLENAMESET fieldname = alias2.fieldnameFROM tablename alias2JOIN [LINKEDSERVER1INSTANCE_NAME].DB.OWNER.TABLENAME alias1on alias2.urn=alias1,urn"[color=blue]>From what I can gather from various sources the SQL Server must be[/color]named the same as the computer which it is installed on. However, if Ihave two instances of SQL Server, they cannot both be named the same asthe computer. Does anyone know of a way around this or whether I'mbarking up the wrong tree completely?Many thanks.
View 2 Replies
View Related
Oct 5, 2007
I have a quick question.
I need to execute some stored procedures in certain steps... all performing some inserts/updates
What i need is, a mechanism, by which i can roll back to the previous state if i encounter an exception (either in the app or SP)
so, if the my first two SP execute fine, perform their functionality like insert/update, and the third one fails...
how can i roll back to the initial state in ASP.NET.
would appreciate any info.
or redirection to the the location where i can look up some info on that.
AJ
View 1 Replies
View Related
Aug 14, 2007
Hi,
I am using distributed transactions where in I start a TransactionScope in BLL and receive data from service broker queue in DAL, perform various actions in BLL and DAL and if everything is ok call TransactionScope.Commit().
I have a problem where in if i run multiple instances of the same app ( each app creates one thread ), the threads pop out the same message and I get a deadlock upon commit.
My dequeue SP is as follows:
CREATE PROC [dbo].[queue_dequeue]
@entryId int OUTPUT
AS
BEGIN
DECLARE @conversationHandle UNIQUEIDENTIFIER;
DECLARE @messageTypeName SYSNAME;
DECLARE @conversationGroupId UNIQUEIDENTIFIER;
GET CONVERSATION GROUP @conversationGroupId FROM ProcessingQueue;
if (@conversationGroupId is not null)
BEGIN
RECEIVE TOP(1) @entryId = CONVERT(INT, [message_body]), @conversationHandle = [conversation_handle], @messageTypeName = [message_type_name] FROM ProcessingQueue WHERE conversation_group_id=@conversationGroupId
END
if @messageTypeName in
(
'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog',
'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
)
begin
end conversation @conversationHandle;
end
END
Can anyone explain to me why the threads are able to pop the same message ? I thought service broker made sure this cannot happen?
View 11 Replies
View Related
Jul 16, 2015
We have control table which will be useful whether we need to start the job or not. If we are starting the Job we will make it to 1.
Below is the Table Structure.
Table Name IN_USE_FG
CUST_D 0
PROD_D 0
GEO_D 0
DATE_D 0
Now we have different packages for 4 tables data loading. These 4 packages will start at a time. Before going to load the data we have to make the Flag to 1 and after that we have to load it. Because of this we have written Update statement to update the Value to 1 in respective Package.
Now we are getting dead lock because we are using same table at a same time. Because we are updating different records.
View 6 Replies
View Related
Aug 29, 2007
Hi,
I have a multiple package solution that I've deployed using the manifest file produced with the development environment. If I need to make a change to a single package, how do I then deploy this package? Is it a case of rebuilding the entire solution and re-running the manifest file, or is there a simpler way?
Any help would be much appreciated, cheers.
View 5 Replies
View Related
Jun 13, 2008
The method I wrote to delete records is working if there's one record, but not for more than one. This method takes a string, and I've examined what is passed in and everything looks ok, but then no error occurs where there's more than one record, but no delete occurs either.
Here's what I see in my Trace.Warn statement: Delete From Photo_TBL where PhotoID IN ('223,224')
So the sql looks fine but I can't figure out why it's not working. Here's my method for deleting. Can you see what might be wrong? Thanks
public void PerformDeletion(string photoID)
{
//Response.Write(photoID);
// Set up SqlCommand, connection to db, sql statement, etc.
SqlCommand DeleteCommand = new SqlCommand();
DeleteCommand.Connection = DBConnectionClass.myConnection;
DeleteCommand.CommandType = CommandType.Text;
// Store Primary Key photoID passed here from DeleteRows_Click
// in a parameter for DeleteCommand
SqlParameter DeletePrimaryKeyParam = new SqlParameter();
DeletePrimaryKeyParam.ParameterName = "@PhotoID";
DeletePrimaryKeyParam.Value = photoID.ToString();
// Insert new parameter into command object
DeleteCommand.Parameters.Add(DeletePrimaryKeyParam);
// Delete row, open connection, execute, close connection
DeleteCommand.CommandText = ("Delete From Photo_TBL where PhotoID IN ('" + photoID + "')");
Trace.Warn(DeleteCommand.CommandText);
// DeleteCommand.Connection.Close();
DeleteCommand.Connection.Open();
DeleteCommand.ExecuteNonQuery();
DeleteCommand.Connection.Close();
// Call BindData so GridView is binded and most recent changes appear
BindData();
}
View 1 Replies
View Related
Dec 31, 2007
I've written a SQL script to go in and pull student grades for honor roll. The first subquery in the script eliminates any students that have any D's, and the second sub query is supposed to give me a only students that have no more than 1 C of any type as the Honor Roll criteria is that a student has to have a GPA between 3.0 and 3.49 and no more than 1 C.
If I run each individual sub query by itself they work and pull the students that they are supposed to. If I run the main query along with the first sub query to eliminate students with D's everything works. If I run the 2nd sub query by itself it will pull the students that meet the criteria. If I run the main query along with both sub queries or the main along with the 2nd sub query it doesn't work.
Here is what the query looks like that I'm trying to run.
Thanks in advance for any help.
select distinct i.personid, i.lastname + ',' + ' ' + i.firstname as student, p.studentnumber, e.grade,
t.name as Term, gs.score, c.name as course, sec.teacherdisplay
from gradingscore gs
JOIN [identity] i on i.personid = gs.personid
JOIN person p ON p.personid = i.personid
JOIN enrollment e on e.personid = p.personid
JOIN term t on t.termid = gs.termid
JOIN v_TermGPA tg on tg.personid = gs.personid and tg.calendarid = gs.calendarid
JOIN v_GpaTermCalc tc ON tc.personid = gs.personid and tc.calendarid = gs.calendarid
JOIN section sec on sec.sectionid = gs.sectionid
JOIN course c on c.courseid = sec.courseid
where gs.calendarid = 20 and t.name = '2nd 6wk' and tc.gpa between 3.0 and 3.49 and
e.enddate is null
--Sub Query to eleminate students with any D's in scores
and p.personid not in
(select distinct gs1.personid from gradingscore gs1
join Term t1 ON t1.termid = gs1.termid
join v_TermGPA tg1 ON tg1.personid = gs1.personid
where gs1.calendarid = 20 AND t1.name ='2nd 6wk'and
tc.gpa >=3.0 AND tc.gpa <= 3.49
and gs1.score IN('D+','D', 'D-')
--Sub Query to eliminate students with more than 1 C of any type in scores.
and gs.personid not in
(select distinct gs2.personid from gradingscore gs2
join Term t2 ON t2.termid = gs2.termid
join v_TermGPA tg2 ON tg2.personid = gs2.personid
where gs2.calendarid = 20 AND t2.name ='2nd 6wk'and tc.gpa >=3.0 AND tc.gpa <= 3.49
and gs2.score IN('C+','C', 'C-')
group by gs2.personid
HAVING count(gs2.score)<=1))
order by i.[student]
View 6 Replies
View Related
Nov 17, 2006
I have a package that reads the contents of 11 Excel files into various tables. Opening this package in the designer, or with DTExecUI is extremely slow. In both cases when I open the package is takes over 10 minutes to do anything. Visual Studio gives the "Visual Studio is Busy" message for 10 minutes and DTExecUI just hangs. DTExecUI actually hangs twice, once when opening the package and a second time when clicking "Execute" (totalling over 20 minutes). It seems like no matter how I try to run the package it will always hang for 10 minutes before running with no status message or anything. Once it runs it completes quickly with no errors.
The various tasks in the package are fairly simple, most being Source > Data Conversion > Destination.
Any suggestions?
View 4 Replies
View Related
Dec 12, 2005
I need to write a query that requires respective fields referencing from multiple tables.
For example, here are the tables:
Main Table:
InfoID Team1 Player1 Team1
Table: Player_ref
Player Team_Player_ref Player1 John doh
Table: Team_ref
Team Team_Player_ref Team1 My Team
Ideal result Table from query:
InfoID Count John Doh 1 My Team 2
Any suggestion to creat the Ideal Results table from query?
Normally, I could do it if it only referenced from 1 table, I would do an inner join, however, since there are 2 referenece table, doing inner join wouldn't work. A proposed suggestion would certainly be nice. Thanks in advance.
--daydreamstuck at the current problem
View 6 Replies
View Related
Mar 15, 2006
I have a 64bit Ent Ed, Created a SSIS package, deployed it, its running when running from sql server but not running as a job
View 1 Replies
View Related
Aug 7, 2015
I have a dts package where user suggested me to run it on nth working day of every month.
View 7 Replies
View Related
May 22, 2005
Hi there,
I have decided to move all my transaction handling from asp.net to stored procedures in a SQL Server 2000 database. I know the database is capable of rolling back the transactions just like myTransaction.Rollback() in asp.net. But what about exceptions? In asp.net, I am used to doing the following:
<code>Try 'execute commands myTransaction.Commit()Catch ex As Exception Response.Write(ex.Message) myTransaction.Rollback()End Try</code>Will the database inform me of any exceptions (and their messages)? Do I need to put anything explicit in my stored procedure other than rollback transaction?
Any help is greatly appreciated
View 3 Replies
View Related
May 8, 2008
Hey guys,
I am pretty new to reporting software and I was just wondering in reporting services 2005 when working with multiple datasets and data connection string in order to populate text boxes if the data is a number it is prefixed with SUM at the start of the expression and if it is text it is prefixed with FIRST even though it is just for one value.
I was wondering if this is normal or have I messed up somewhere?
Many thanks.
View 1 Replies
View Related
Aug 30, 2006
I had a Send email task linked to my Sequence Containers in my package and it was working fine. Everytime the container fails it would send an email to myself.
At some point all Failure constraints stopped working. Failure constraints work if I add brand new tasks, but with the existing tasks, they don't work. The Task which fails, turns red and execution stops. Next failure task is not executed.
I am not sure what triggered it to stop working. I cannot get anything on the log
Any help is appreciated.
View 2 Replies
View Related
Aug 5, 2006
I have a script that changes the name of a file after a data upload. The script works fine if I execute the package in Visual Studio but when I run the file package from a SQL server job it does not rename the file. The data does get uploaded it just does not run the final script.
Any help would be appreciated.
Steve
View 1 Replies
View Related
Oct 22, 2015
Replicate ddl setting is not working if multiple subscribers are used...
View 2 Replies
View Related
Jun 7, 2006
I have a dataset that is between 40-50K records that has to go through a process that is pre-defined. SSIS works just fine with the smaller sets even up to 20K but this job keeps blowing up saying something along the lines of cannot write to recordset destination. Does this make sense to anyone? The sever is a 2 processor with 2GB of ram. Physical memory usage spikes to about 1.6GB during the run but the processor never really gets above 30% usage. Does this product just not scale yet?
View 1 Replies
View Related
Jul 27, 2006
I notice when I copy an SSIS package 'A' to a new package 'B', the new package 'B' will generate a "login failed for user" message in the data flow components. To copy I "save copy of Package 'A' as."
Some config info:
Package ProtectionLevel = EncryptSensitiveWithPassword
Connections are Data Sources
Connection strings with password are stored using PackageConfigurations to an SQLServer table. I've verified Package 'A' is in fact using the config table (e.g. it is not using a password or user stored in the package)
Data connectios are all SQLServer Native OLE DB Client
The account is an SQLServer account (not integrated security)
The original Package 'A' works flawlessly and I get success when I test the connections in Package 'B'.
But executing package 'B' I get: The error message I get is: [Connection manager "MyConnection"] Error: An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E4D Description: "Login failed for user 'dwuser'.".
Does anyone know why this would occur and/or how to work around it? I saw another thread where a potential workaround is to create a new data flow task and copy all the data flow components to that task. That won't work well for us because the data flow is moderately complex and when you copy and paste it, SSIS completely re-orders the layout.
This is a typical data warehouse ETL setup where there is a master package that executes child packages (e.g. 'A', and 'B' mentioned above) that each perform the ETL for a specific dimension or fact table.
Thanks for any help,
Lee Cascio
View 3 Replies
View Related
Sep 18, 2014
I am tring to send an email reminder to multiple users using a cursor.
declare emailCursor cursor for
select name,info,default_email, @MyMessage
from My_Temp
open emailCursor
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage
while(@@FETCH_STATUS = 0)
begin
-- select name,info,ins_default_email,@MyMessage
--from temp
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Hello',
@recipients = @Recipients,
@from_address = '<address.com>',
@Body = @MyMessage,
@subject = 'Subject'
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage
end
close emailCursor
deallocate emailCursor
Currently I have two users in my table that I want to send email to, but when the stored procedure runs I got two emails for the last user in the table instead one for each user.
View 2 Replies
View Related
Feb 28, 2008
Hi everyone, I have a DTS package on my SQL Server database that returns several different results. Does anybody know how I would access any one particular part of the return. I am trying to make it so that there is only one run to the database for the information, but am not sure how to get just the parts I want out of the DTS package. for Example, here is my DTS Package:
Select @InvoiceNo as InvoiceNo, '02/01/08' as PaymentDate, 1000.00 as PaymentAmt, 500.00 as RemainingAmt, 'X31235X' as ReceiptNumber
Declare @Results Table ( InvoiceNo char(10), Amt float)
Insert Into @Results Values('SNJ0100001',100.00)Insert Into @Results Values('SNJ0100002',200.00)Insert Into @Results Values('SNJ0100003',300.00)
Select * from @Results
How would I ask for just the results from the @Results section and then somewhere else on my page I will want to return just the results from the @InvoiceNo section?? I would normally call the package from my code-behind and I know how to do that, just not to pull a particular section. Here is what I have so far on that section:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"SelectCommand="hsp_rpt_AR_ReceiptStatus" SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameter ControlID="TextBox1" Name="InvoiceNo" PropertyName="Text" Type="String" /></SelectParameters></asp:SqlDataSource>
Thanks for any helpRandy
View 1 Replies
View Related
Mar 21, 2008
i want to make a package to export data to multiple PLE DB detination from one one flat source.
can any body tell how to create ?
View 5 Replies
View Related
Dec 17, 2006
Hi,
I have a file-deployed package which I need to call N times at once using DTEXEC. When I attempt to execute N instances of the package, the second instance doesn't execute. I can execute different packages at the same time, but never the same package more than once. Does anyone know how to get this scenario working? Just to clarify a bit more - I can call the package as many times as I like as long as I wait until the previous run of DTEXEC is finished. Please help!
Thanks,
dcb99
View 2 Replies
View Related
Jun 28, 2006
Hi
I am working on on SQL Server Integration Services and facing few problems in it.
Actually am supposed to create a package that would automatically pick excel spreadsheets with a specific format and import it onto the SQL server.
(Lets say , there is a company named AB and they have got various products named CD,EF and GH and each product has its own spreadsheet in which its monthly sales(JAN, FEB,...NOV, DEC) is given. So i have to build a generic package for each product (lets say CD) so that i don't have to import every spreadsheet seperately for each month.
To summarize i just have to build a package where i can deploy the various spreadshhets again and agian instead of building a package for each and every month spreadsheet seperately.
I have tried and used lots of combinations like Loop
conatiners etc. but still am not able to find a solution to it.
Please help me out on this.
View 12 Replies
View Related