Using RetainSameConnection During Distributed Transaction In SSIS ForEach Container
Aug 15, 2006
Hi -
I've seen variations on this question in this forum, but none of the suggestions work for me, so any ideas would be greatly appreciated!
I have a SSIS package whose function is to monitor a directory for flat files and distribute the information in these files into a SQL 2005 DB for further processing later. I've configured Transactions for the package as serializable and supported, and I have a ForEach container set to serializable and required. All SQL and Data Flow tasks take place within this container. I have a single Connection Manager to pull in the flat input file, and another for the connection to the SQL DB. This setup will function, and roll back if necessary, but I take a huge hit on the continual establishment of connections to the DB. If I set the retainsameconnection property on the SQL DB Connection manager, I get an error when executing my first Data Flow task to move data from the flat input file to working tables within the DB: 0xC001A004 - Incompatible transaction context was specified for a retained connection. If I turn off Transaction support, the retainsameconnection property works as expected.
I've been running Profiler Traces, and can verify that no connection has been established to the SQL Server prior to execution of this task, so it seems like the context should be OK. I would welcome any feedback, suggestions or alternatives.
Thanks,
Jim SweeneySLC
View 2 Replies
ADVERTISEMENT
May 24, 2006
Could someone send me any links or information on how to loop through an ADO.NET dataset in SSIS? I need step by step information please.
Thank you,
Shiva
View 32 Replies
View Related
Feb 22, 2007
I have a design a SSIS Package for ETL Process. In my package i have to read the data from the tables and then insert into the another table of same structure.
for reading the data i have write the Dynamic TSQL based on some condition and based on that it is using 25 different function to populate the data into different 25 column. Tsql returning correct data and is working fine in Enterprise manager. But in my SSIS package it show me time out ERROR.
I have increase and decrease the time to catch the error but it is still there i have tried to set 0 for commandout Properties.
if i'm using the 0 for commandtime out then i'm getting the Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
and
Failed to open a fastload rowset for "[dbo].[P@@#$%$%%%]". Check that the object exists in the database.
Please help me it's very urgent.
View 3 Replies
View Related
Mar 24, 2014
why when I make a change to a foreach loop container in a SSIS package it does not save?
I am trying to change the base file name and if I change it through either the edit or properties windows, the changes does not save. Fore example i change the Files: or File Spec: from oldfile*.txt to newfilename*.txt and when I save and og bak into the edit area to confirm the change, the Files: section shows as "oldfile*.txt.
View 4 Replies
View Related
Jul 9, 2015
in a my SSIS 2012 pkg I'm using a Foreach ADO Enumerator container that reads an object variable in order to get an id value.This identifier is passed as an input parameter to an Execute SQL task to update an Oracle table: if this task fails the id is written on a SQL Server table. After the Execute SQL task execution, with success or failure, the flow go to another task in the container.
When an error occurs for the update on Oracle table, each tasks inside the container are executed but the container fails and the loop ends.I'd like to complete the entire loop respect to the identifiers present in the object variable also if the update operation on Oracle table goes in error.
View 5 Replies
View Related
Apr 4, 2007
How do you sort files from the Foreach loop container?
I love this component, except I can't get it to sort by filename.
Nice to know how to sort by timestamps also.
Dave
View 27 Replies
View Related
Apr 22, 2008
Hello
I have a question
How is foreach loop container - foreach ADO enumerator performace in SSIS package compares to use of cursors in stored procedures
Is there any articles comparing them
I understand a lot of factors can affect the performance, however what is expected performance for the foreach ADO enumerator loop for large dataset. What is Microsoft recommendation for that - recommended - not recommended (using large datasets - over million records)
Thank you
Arminr Bell
View 4 Replies
View Related
Sep 8, 2015
I am having a challenge to pass the filename variable from SSIS Foreach Loop Container to SQL store procedure. I have an "Execute SQL Task" inside "Foreach Loop Container" which will receive the input filename parameter passed by the Foreach Loop Container. The store procedure command line is defined as "EXEC sp_mySQLStoreProcedure ?" within the "Execute SQL Task". The Foreach loop container will gather the filenames from File System then put it in the filename variable one by one. I would like to pass the filename variable as the input parameter to the sp_mySQLStoreProcedure in the "Execute SQL Task". How can I connect the variable and the store procedure so that it will process all the input files gathered by the Foreach Loop Container?
View 4 Replies
View Related
May 6, 2015
In order to update an Oracle table target from a SQL Server table source I need to use a Foreach Loop Container, so I can loop on the rows of the SQL Server table source. This source table has two columns: the old identifier to update and the new identifier to apply. I must use the value of the old identifier to filter the Oracle rows to update, while the new identifier is the new value to assign to the filtered old identifier.
I already know how to use the Foreach Loop Container when it is necessary to loop on an unique column of a table/view (using an object variable, using a Foreach ADO enumerator, etc.), but I need to loop on two columns.
View 8 Replies
View Related
Apr 21, 2008
Hello
I am trying to use Foreach loop container - Foreach File Enumerator
Is there easy way to retrieve enumerator configuration folder from variable - so I can easily move package from server to server?
I would like to have name of the folder we getting files from retrieved from variable by using this control
Thank you in advance
Armine Bell
View 3 Replies
View Related
Feb 29, 2008
We have a test db, a staging db and a live db. I have a stored procedure that runs fine on test and staging, but throws the following error on live.
The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.
The stored procedure uses linked servers and a transaction.
We're using the following transaction code in the stored procedure
BEGIN
BEGIN TRANSACTION
BEGIN TRY
---
procedure stuff here
---
COMMIT TRANSACTION
END TRY
BEGIN CATCH
DECLARE @ErrorSeverity INT, @ErrorNumber INT, @ErrorMessage NVARCHAR(4000), @ErrorState INT
SET @ErrorSeverity = ERROR_SEVERITY()
SET @ErrorNumber = ERROR_NUMBER()
SET @ErrorMessage = ERROR_MESSAGE()
SET @ErrorState = ERROR_STATE()
IF @ErrorState = 0
SET @ErrorState = 1
RAISERROR ('ERROR OCCURED:%d', @ErrorSeverity, @ErrorState, @ErrorNumber)
IF XACT_STATE() < 0
ROLLBACK TRANSACTION
END CATCH
END
I found the following link which seems to be the problem we're experiencinghttp://support.microsoft.com/kb/937517
The link includes a workaround which is the following:
"To prevent the SQLNCLI provider from sending an attention signal to the server, use the SQLNCLI provider to consume fully any rowsets that the OLE DB consumer creates. "
How do I use the SQLNCLI provider to fully consume any rowsets?
View 11 Replies
View Related
May 31, 2008
Hi All
I'm getting this when executing the code below. Going from W2K/SQL2k SP4 to XP/SQL2k SP4 over a dial-up link.
If I take away the begin tran and commit it works, but of course, if one statement fails I want a rollback. I'm executing this from a Delphi app, but I get the same from Qry Analyser.
I've tried both with and without the Set XACT . . ., and also tried with Set Implicit_Transactions off.
set XACT_ABORT ON
Begin distributed Tran
update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TRANSACTIONMAIN
set REPFLAG = 0 where REPFLAG = 1
update TSADMIN.TRANSACTIONMAIN
set REPFLAG = 0 where REPFLAG = 1 and DONE = 1
update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.WBENTRY
set REPFLAG = 0 where REPFLAG = 1
update TSADMIN.WBENTRY
set REPFLAG = 0 where REPFLAG = 1
update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.FIXED
set REPFLAG = 0 where REPFLAG = 1
update TSADMIN.FIXED
set REPFLAG = 0 where REPFLAG = 1
update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.ALTCHARGE
set REPFLAG = 0 where REPFLAG = 1
update TSADMIN.ALTCHARGE
set REPFLAG = 0 where REPFLAG = 1
update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TSAUDIT
set REPFLAG = 0 where REPFLAG = 1
update TSADMIN.TSAUDIT
set REPFLAG = 0 where REPFLAG = 1
COMMIT TRAN
It's got me stumped, so any ideas gratefully received.Thx
View 1 Replies
View Related
Jan 22, 2008
Hello Experts,
Sorry that I open a new thread again but I didn€™t found any good tutorials about foreach loop container. I would like to read every row from one table and do something.
I red something about sql task€¦ Can someone give a little instruction, please?
Kind regards,
Alex
View 3 Replies
View Related
Feb 15, 2007
Hi
I using data flow task to import from flat file to database but i need to use Foreach Loop Container to import multiple files in specific folder and all will be insert in the same table
tahnks & Regards
View 1 Replies
View Related
Aug 22, 2006
Is there a way to set a variable as a substring of the enumerator in a Foreach File Enumerator type? The Variable Mappings tab in the Foreach Loop Editor does not allow you to enter an expression.
Fred
View 13 Replies
View Related
Mar 30, 2007
Hi
Can anyone point me to an example of using a ForEach Loop Container to step through the rows in a recordset. I cannot seem to see how this is done from the help files.
Thanks
View 6 Replies
View Related
Nov 6, 2006
Hi
Currently the ForEach Loop container is set to loop over the entire collection of records in my table, but I only need to loop thru the records where the status = x. How is that possible? Can I use expressions to set the enumerator to do something like this. Basiclly the collection values are used for further processing, and I would like to avoid looping thru records which have been processed already, which means they already have a status set to y. Please let me know. Thanks.
MA
View 6 Replies
View Related
Nov 8, 2006
Hi,
My Foreach Loop container has 10 different task inside. I want to execute the first task only one time. I have a variable with increases for each repition. How can I put precedence contstraint on the first task so that it should execute only first time and other task has to execute all the time.
Thanks
View 4 Replies
View Related
May 26, 2006
With a ForEach container, configured to loop through files in a
directory, if I have a problem with a file.. can I direct the loop to
skip on to the next file?
I'm processing structured files, first record of each is some
header info, body records are in the middle, and then the last record
is a trailer containg a checksum
So, for each file in the directory, I split the records into three raw
files, one for header rec(s) , one for body recs and one for trailer
recs. (based on line numbers and using a conditional split to direct
the records)
Then I start by processing the header recs in a dataflow.. if all goes
well there I move on to the next dataflow to process the body recs from
the DataRecs raw file.. etc...
I would like to do some validation at each processing step.. if a
header rec fails validation say... then I'd like to just stop
processing that file and move onto the next file...
Now, I don't see my validation throwing an exception... so its more
that I'd decide (maybe using an Audit ) that the header doesn't pass
validation.. then I'd like to put a record in an error table (with info
about filename, source etc, not just content of the current data row)
But not sure what approach to take on this...
If there is an appropriate section in BOL please point me at it...
Thanks
PJ
View 13 Replies
View Related
Feb 9, 2007
Hi everyone,
I am having hard time with foreach loop container. The for each loop container in my package goes over all the rows in a ADO enumerator recordset variable and shows row values one by one in message box. The problem is that it just keeps printing the first row infinitely. Could anyone tell me what could be wrong?
Thanks in Advance,
View 3 Replies
View Related
Feb 13, 2007
I have a few hundred data files that I need to process in groups from oldest to most recent. To that end, I have created staging folders for each date that appears in the file names (example: 20060213) and moved all of the data files to the appropriate folders.
I also have these folder names in a recordset that has been sorted in ascending order, so the oldest date should be the first record, the second-oldest date should be second and so on. My thinking is to use this recordset with a ForEach Loop Container to loop through each folder, but I am not sure if Integration Services will necessarily loop through the records in order.
Can someone tell me whether the records will be processed in order or suggest a better alternative to make sure the directories are processed in the correct order?
View 2 Replies
View Related
Jan 12, 2008
Dear All!
I have a "Foreach Loop Container" to search files in a folder. And I only want to search .txt and .txt.gz file. I set property "FileSpec" as "*.txt,*.txt.gz" but my container dont run. Can you help me?
Thanks
View 3 Replies
View Related
Feb 6, 2007
I am getting this error :Distributed transaction completed. Either enlist this session in a new
transaction or the NULL transaction. Description:
An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error and
where it originated in the code. Exception Details:
System.Data.OleDb.OleDbException: Distributed transaction completed. Either
enlist this session in a new transaction or the NULL transaction.have anybody idea?!
View 1 Replies
View Related
Dec 22, 2006
i have a sequence container in my my sequence container i have a script task for drop the existing tables. This seq. container connected to another seq. container. all these are in for each loop container when i run the package it's work fine for 1st looop but it gives me error for second execution.
Message is like this:
Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
View 8 Replies
View Related
Jan 8, 2008
Hi,
i am getting this error "Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.".
my transations have been done using LINKED SERVER. when i manually call the store procedure from Server 1 it works but when i call it through Service broker it dosen't work and gives me this error.
Thanks in advance.
View 2 Replies
View Related
Jan 4, 2007
Hello,
I want to set up a Foreach loop container to loop through several flat files. I have a connection manager set up for individual flat files. The metadata for the files is all the same. They are fixed width files, and contain sixty five columns.
I didn't see a place in the container properties to configure the metadata of the files. How can a Foreach Loop Container 'know' the metadata of the flat files that I want to loop through?
Thank you for your help!
cdun2
View 10 Replies
View Related
Sep 19, 2007
Hi,
Another classic example of something silly I must be doing
I have a "Foreach Loop Container" which uses a "Foreach ADO Enumerator".
The object source is a recordset variable.
Inside the "Foreach Loop Container", a lot of things are happening - some Execute SQL Tasks, Send Mail Tasks, Script Tasks and also a couple of Sequence Containers.
Now, I am getting 2 records in the recordset, but, the "Foreach Loop Container" executes just once.
Any Ideas?
Thanks in advance.
Regards,
B@ns
View 3 Replies
View Related
Nov 7, 2007
I have an Execute SQL Task that reads columns as strings but can be null. I feed the information in the result set to a foreach loop container and when nulls are encountered the package dies there. Is there an easy way to deal with this other. I have changed all of my null possible columns to object types but I don't want to do this for all of the possible null columns.
Thanks
View 11 Replies
View Related
Apr 23, 2008
Hello
I would like to loop through a folder and then log the folder's content, as in the names of the files, into a database like all the events get logged. Here is what i have done. I put some files into the folder c: emp made a loop through it, set up a variable 'temp' scope is the foreach loop, set the variable raisechangedevent to true. I have also confgigured the loop to put the result of the looping, in the temp variable in the variable mappings tab.
Strangely nothing is recorded into the "execution results" when i test run the package ? Do i need to make a event handler for the onvariablevaluechanged event for the foreach loop container to be able to get the value of the variable logged or is there something other that i'm missing ?
View 5 Replies
View Related
Mar 1, 2007
Dear all,
I have a problem using SSIS since I was a beginner, the problem is I have to do some data transform from flat files into database. These flat files come from many branches of my office with the file structure like this D:SSISranch_nmfile_nm.txt, in folder SSIS there are many branch_nm folder and each branch_nm folder contains many flat files.
My idea was grab the branch_nm folder into array variable using Script Task and then loop this array variable using ForEach Loop Container to get the file and using it for Flat File connection, but I don't know the way to do it.
May this idea work out for sure ?? How to use array variable, that we previously defined inside Script Task, in ForEach Loop Container ?
Thanks in advance
View 11 Replies
View Related
Apr 12, 2007
Hi everyone,
I've got a Foreach loop container which uses a Foreach ADO Enumerator and works fine.
But problem comes when I launch inside the general loop another Sql Task (select) which sometimes has rows and sometimes hasn't. When it have rows everything is fine the workflow follows fine but when it has not.
I obtain this error (obvioulsy)
[Execute SQL Task] Error: An error occurred while assigning a value to variable "GZon": "Single Row result set is specified, but no rows were returned.".
How to deal with that?
Thanks indeed
View 5 Replies
View Related
Jun 17, 2006
Hi,
My requirement is I have to read 2 sets of files from a folder. For example, I have to read all files starting with either 'a' or 'b' only. In 'Foreach Loop', if I say 'a*,b*', it is not working. Instead of comma (,), I tried colon, semi-colon and pipeline characters also. It is not working. So I am using 2 loops now. But I would like to know is there any way to do it using a single loop?
Thanks.
View 8 Replies
View Related
Jan 8, 2008
In all of our extract packages, we use a foreach loop container to grab files from the 400 sitting out in a certain directory. For this particular package, we have specified the files should be named RP*.* We know there are several files out in the directory. The package runs without error and completes, but says no files were found in the directory with that name. What could be causing this issue? Thanks!
View 3 Replies
View Related