Locked Excel File Due To OnError
Sep 2, 2007
I have a package the looks for any Excel files in a folder, moves the data to a SQL table, then archives the file to one of two archive folders--a success folder or an error folder. I have an OnError handler on the Data Flow that sets a flag that lets the archive process know where to move the file.
This works when the processing is successful. It also works when the error in the Data Flow occurs right off the bat, i.e., in the Source. When the error occurs later on, say in the Destination, it doesn't work correctly. In this case, the OnError sets the flag, but when the archive process tries to move the Excel file, it can't because it's locked. I assume this is because OnError interrupted the Data Flow before the Excel file could be closed properly.
Any ideas on how I can avoid this problem? Can I manually get the Data Flow to close the Excel connection somehow?
View 1 Replies
ADVERTISEMENT
Jun 14, 2006
Hello All,
Hopefully one of you gurus can offer a solution to this problem:
First off I do not have the ability to use SQLMail - so that is not an option.
I have a DTS package that performs the following steps in order to populate an excel sheet with some data and email it off to a coworker:
1) FTP Task to copy excel sheet template from one folder to another on same machine
2) Data pump between SQL server connection (local) and copied excel sheet.
3) SQL script task which truncates a table on the sql server
4) activeX script task which contains the following code that uses CDO to attach the excel sheet that was just populated to an outgoing email:
Function Main()
Dim iMsg
set iMsg = CreateObject("CDO.Message")
Dim objMail
Set objMail = CreateObject("CDO.Message")
objMail.From = "from@from.com"
objMail.To = "to@to.com"
objMail.AddAttachment("F:copiedexcelsheet.xls")
objMail.Subject="subject"
objMail.HTMLBody = "Body"
objMail.Send
Set objMail = nothing
Main = DTSTaskExecResult_Success
End Function
The result of DTS execution is a failure on the activeX step:
Error Description: The process cannot access the file because it is being used by another process.
I assume this means Excel still has its grubby paws on the file - but I've tried alleviating this by (1) using a waitfor delay between the excel connection and the activex script task and even by (2) using the run package task to run a separate package that only has the activex mailsender script in it (thinking the parent package would terminate along with the excel process before running the next package - maybe I'm wrong here?).
Can anyone suggest a solution to this!?
Thanks!
K
View 6 Replies
View Related
Dec 18, 2007
My mdf and ldf files were locked by windowsXP. Iam not using these files in anywhere of my two instances of databases.
Even after stopping SQL SERVER 2005 iam not able to cut or copy those files.
How to recover this files.
View 5 Replies
View Related
Nov 16, 2006
Hi Folks,
When I create a Database and try to copy the MDF file, I get a message to say that the Database is locked or in use by another user.
Seems like maybe I am not doing a 'Save' operation - although I can't find one ?
If I shut down the PC and restart it, then the MDF File is freed up, although when I try to open it, there is something wrong with it.
I'd appreciate any suggestions.
Thanks a lot.
Barry
View 4 Replies
View Related
Mar 15, 2006
I am writing a package to process perfmon logs. The issue I have come across is that the perfmon process holds onto the log file and SSIS fails because it wants to exclusive read access. Is there any way of getting SSIS to not take an exclusive read on the file.
I can read the file in notepad fine but not SSIS.
View 1 Replies
View Related
Jan 29, 2003
Guys.
This has been an issue for me. It happens once in a while.
I am importing a File from a shared folder thru DTS package. Once in a while the DTS package fails due to the following error.
"Error Opening Data File: Process cannot access the file because it is being used by another process"
Is there anyway I can specify that the file is going to be opened in read only, so that the DTS will not fail?
Any other solution/suggestion?
-MAK
View 1 Replies
View Related
Jul 20, 2006
I have the Excel Connection Manager and Source to read the contents from an Excel file. For some reason couple of numeric fields from the Excel worksheet are brought over as nulls even though they have a value of 300 and 150. I am not sure why this is happening. I looked into the format of the fields and they are set to General in Excel, I tried setting them to numeric and that did not help.
All the other content from the excel file is coming thru except for the 2 numeric fields.
I tried to bring the contents from the excel source to a text file in csv format and for some reason the 2 numeric fields came out as blank.
Any inputs on getting this addressed will be much appreciated.
Thanks,
Manisha
View 5 Replies
View Related
Jul 14, 2015
Is there anyway to  send excel file from ssis using send mail task without saving the excel file locally. I need to automate the process which involves loading the excel file from the database and send it to some people.Â
View 6 Replies
View Related
Jul 25, 2015
Trying to upload excel in server where excel is not installed. BIDs was there in the server, when i am trying to craete Excel source I am not able.what the workround for this.. How to upload excel without excel installed on the server.
View 4 Replies
View Related
Nov 19, 2007
I am using a Excel Source to get the data from an excel file to sql server 2005 table. A couple columns are coming in a double precision float, but some values have characters in them, but those values are coming out as null, even though I changed the datatype from float to unicode string. Any inputs on resolving this will be much appreciated.
Thanks,
Manisha
View 4 Replies
View Related
Sep 13, 2015
We have 10 sheets in Excel File and 10 sheet contains errror data. How to load 9 sheets data in to 1 destination and error data in to other destination?
View 4 Replies
View Related
Dec 18, 2006
i have an SSIS package that exports to an excel file. This works fine. the problem is that it appends the data instead of overwriting the file. Is there any way to overwrite the file like you can with a flat file? I have to email the file everyweek and don't want to have to clear it out manually. Any help would be appreciated
View 2 Replies
View Related
Sep 25, 2006
Good Day to all,
Hope you could help me w/ my project.
Im creating a DTS Package. The source data will be coming from an excel file going to my SQL table. The DTS package is scheduled to execute daily, but the source data will be coming from different excel filename.
Example, today the DTS will get data from Data092506.xls. Then tomorrow, the data will be coming from Data092606.xls.
How can I do this? The DTS I've already done has a fixed source data file.
Please help.
Thank you so much.
God Bless.
View 9 Replies
View Related
Aug 26, 2015
I have a ssis package where I need to have excel destination. Â In the Excel file, I need to have few rows with some text and then populate data below the text. One the text is like this:
Data as of: Â 08/25/2015
if the report ran today, then Data as of will have Yesterday. So, if the user opens that excel file after a week, then user should see same  Data as of:  08/25/2015. not today()-day(1).
I was planing to handle on excel side with today()-day(1). but it only works the day it was run. Then the excel file is open after few days later, then it might as Data as of:  08/30/2015 which is not true. It should still stay Data as of:
 08/25/2015 on what ever date the excel file is open. The SSIS package  runs only once.Â
How do I handle this so that whenever user open the file, they will see Data as of:  08/25/2015. This is not a column in excel. It is like a description of data in excel.
View 3 Replies
View Related
Dec 28, 2007
hi all;
1. Excel file Source--> monthly Revenue details
2. Derived Colum Transoformations
3. Oledb Destination
its my flow in one of my packates (ETL job)
Excel file contains monthly revenue details, i wanna import the excel data to my database staging table, so i've created the package.
its working fine...
Problem
if we change the new data for the next month and running the package its not running;
the same file, same format, only we delete the contents, of the file except first row of the excel sheet,
and pasting the new data;
new data is coming from Oracle DataBase in the form of excel sheet ( manually they will copy the data and sending to us)
i open that package in design mode and while double clicking the excel file source it says <column name>'s Meta Data needs to be synchronized
Do you want to Fix this issue automatically with the available external column's meta data
Clearly noted that its a data type issue; i have changed the corresponding data types as it is in the previous Excel sheet which is equivalant to the Table its copying to.
now the package is running with validation warnings, External Column "Invoice Amount" needs to be updated...etc. some 2 or three warning messages i can able to see in the package Execution wizard,
ok, i'm ready to accept these warnings, and i want my package running from my server;( packages had been deployed in to the Centeralized server; every time if we want to run the package, we have the asp.net webpage, that is executing the package in an On_click event)
The package is not running from the server, its due to the meta data change in the Excel file( i guess)
please suggest me some guide lines to resolve this meta data issue, i want my excel sheet meta data should not change when we have new updates in it;
otherwise suggest me some solutions that i can validate the excel sheet before running the package and testing whether the data is in correct format or not? its a kind of Data Profiling activity;
i know its some what crazy, but i need to maintain the system with permanent solution, instead of facing this meta data mismatch issue!!!
some what lenthy explanation--> its needed for my dear powerful microsoft responders. i think i 've explained my problem clearly, if i don't let me know your queries, i'll try my level best.
View 3 Replies
View Related
Jan 3, 2007
Dear all,
I am deploying programatically an Excel 2007 file to a SQL Server 2005 Reporting Server. The problem is that if a file with the same name already exists, that file isn't replaced. I would like the opposite to happen. I'm using the following code:
--Executable
set svr=http://w3sdwsqld1/reportserver
set src_fld="\w3sdwsqld1\deploy\SAD\ECRANS\UPDATES_20061127_190000\Ecrans\AM\Associados\"
set dest_fld="Associados"
set script="\w3sdwsqld1\deploy\SADECRANS\UPDATES_20061127_190000\Ecrans\AM\Associados\PublishReports.rss"
REM Sample: deploy.bat http://w3sdwsqld1/reportserver "\w3sdwsqld1\deploy\SAD\ECRANS\UPDATES_20061127_190000\Ecrans\AM\Associados\" "Associados" "\w3sdwsqld1\deploy\SADECRANS\UPDATES_20061127_190000\Ecrans\AM\Associados\PublishReports.rss"
for /R %src_fld% %%f in (*.xlsx) do rs -i %script% -s %svr% -v ParentFolder=%dest_fld% -v reportP="%%~nf" -v path=%src_fld%
PAUSE
--rss Code
'
' Script Variables
'
' Variables that are passed on the command line with the -v switch:
'
' (a) parentFolder - corresponds to the folder that the script creates and uses
' to contain your published reports
' (b) reportP - corresponds to the report to publish
Dim ROOT As String = "/SAD/Ecrans/Ecrans/AM"
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentPath As String = ROOT + "/"+ parentFolder
Dim filePath As String = path
Dim report As String = reportP
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
'Create the parent folder
Try
rs.CreateFolder(parentFolder, ROOT,Nothing)
Console.WriteLine("Parent folder {0} created successfully", parentFolder)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
'Create shared data source
'CreateSampleDataSource("Solucao_Integrada", "OLEDB-MD", "Data Source=dwareas1;Initial Catalog=SAD_Solucao_Integrada")
'Publish the sample reports
PublishReport(report)
End Sub
Public Sub CreateSampleDataSource(name As String, extension As String, connectionString As String)
'Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
definition.ConnectString = connectionString
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = extension
definition.ImpersonateUser = False
definition.ImpersonateUserSpecified = True
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(name, parentPath, False, definition, Nothing)
Console.WriteLine("Data source {0} created successfully", name)
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
Public Sub PublishReport(ByVal reportName As String)
Try
Dim stream As FileStream = File.OpenRead(filePath + reportName + ".xlsx")
Console.WriteLine(reportName)
definition = New [Byte](stream.Length) {}
stream.Read(definition, 0, CInt(stream.Length))
stream.Close()
Catch e As IOException
Console.WriteLine(e.Message)
End Try
Try
rs.CreateResource(reportName + ".xlsx", parentPath, True, definition, "application/x-excel", Nothing)
Catch e As Exception
Console.WriteLine(e.Message)
Console.WriteLine("Failed to publish report")
End Try
End Sub
--------------------------------------------------------------------------------------------------------------------
Any thoughts? Many thanks,
Pedro Martins
Portugal
View 3 Replies
View Related
Aug 2, 2007
I hope someone can help me with this - I started receiving this error message in the past month or so when I open a csv report and save it as an Excel file in a folder I use on my VPN and in My Documents. It does not show up when I save it to my Desk Top.
I have Microsoft Office Student and Teacher and Office XP Professional installed on my notebook. I tried to uninstall Office XP and it would not let me. Something about a "patch could not be opened......"
The error message is as follows:
Header: .NET-BroadcastEventWindow.2.0.0.0.33c0d.0.EXCEL.EXE-Application Error
Excel error message The instruction at 0x0beab865 referenced memory at "0x00000008"
The memory could not be "read".
Click ok to terminate the program.
I hope someone could please help me with this I received 60 - 80 csv files a week and everythime I save on I get this pop up message!
Thank you!
Leslie
View 1 Replies
View Related
Nov 5, 2007
Hi everyone,
I have a package setup like this:
PackageA -> ContainerA -> ContainerB -> ExecutePackageTaskA (calls PackageB)
PackageB -> ScriptTaskA
If an error occurs in ScriptTaskA from PackageB, the OnError event handler in PackageA fires once and catches the event from ScriptTaskA; that is, the output of the SourceName system variable is "ScriptTaskA" from PackageB. So far so expected.
Now, the same error is handled differently by PackageA's OnTaskFailed handler. The OnTaskFailed handler fires twice - once for ScriptTaskA and once for ExecutePackageTaskA; that is, two outputs are returned - one for "ScriptTaskA" and the second one for "ExecutePackageTaskA". That's strange to me.
Why does the OnError handler only fire once and the OnTaskFailed twice? Is there a setting that does this?
Thanks in advance,
Langston
View 8 Replies
View Related
Jul 21, 2015
I'm importing a multi tab spreadsheet using Import wizard, which I understand to use the same internals as SSIS. The total number of columns in the spread sheet will be over 500. The import wizard defaults everything to varchar 255. I understand there is an XML file I can manipulate to change this and they are located
C:Program FilesMicrosoft SQL Server100DTSMappingFiles
Assuming one of these will control Excel defaults, which one is it? None of the names lend themselves to the Excel as a source. SqlClientToMSSql10?
View 6 Replies
View Related
Aug 30, 2006
Hi
We are generating log file in our SSIS package by enabling the built-in feature of SSIS tool. We are generating log for the "OnError" event. This also recorded the error/failed task messages in the text file "log.txt". That error information is too complex with more unwanted information like below
----------------OnError,,,pkgExtract,,,8/30/2006 11:50:04 AM,8/30/2006 11:50:04 AM,-1071636471,0x,An OLE DB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
OnError,,,pkgExtract,,,8/30/2006 11:50:04 AM,8/30/2006 11:50:04 AM,-1071607780,0x,There was an error with input column "create_user_id" (116) on input "OLE DB Destination Input" (103). The column status returned was: "The value violated the integrity constraints for the column.".
OnError,,,pkgExtract,,,8/30/2006 11:50:04 AM,8/30/2006 11:50:04 AM,-1071607767,0x,The "input "OLE DB Destination Input" (103)" failed because error code 0xC020907D occurred, and the error row disposition on "input "OLE DB Destination Input" (103)" specifies failure on error. An error occurred on the specified object of the specified component.
---------------------------------
This is infact not in a better readable format. We also don't want to do our error logging in database.
Is there any way of defining our error log and create error error log with customization of our messages . Can we do it using OnError event handler.
Please help us with some good solution to avoid giving this confused error log messages.
Thanks
Kumaran
View 1 Replies
View Related
Oct 19, 2006
Is the Onerror Event Handler from the tabbed window in the IDE the same as the red arrow paths that can be used in the control flows and Data Flows?
If yes, what and where is the best practice to use?
If not, can you elaborate?
Thanks,
View 4 Replies
View Related
Apr 17, 2007
Hi,
I am having a few problems getting the opomum configuring the OnError event hendler for my new package. What im trying to do is log the Error event and sound out an email (which i am achiving) where i am encountering a problem is trying to determin the severity of the error.
What i would like to achive is to send an email and log the error (as i currently do) but if the error has the power to stop the package from executing i would like to fire an additional script to move the loading files to a failed location.
My initial thoughs were to put an expression the on the procdural constraint in he error handeler but i cant find which System variable to apply the logic to.
Anyone any suggestions?
Thanks
Paul
View 2 Replies
View Related
May 25, 2008
Hi,
The IDtsEvents.OnError method has a boolean return type whereas most of the other methods on that class are voids.
Why does OnError return a boolean?
What is the effect of returning true?
What is the effect of returning false?
Thanks in advance
-Jamie
[Microsoft follow-up]
View 4 Replies
View Related
Nov 2, 2006
I am using following script to combine all the System:ErrorDescription on OnError
Dts.VariableDispenser.LockForRead("ErrorCode")
Dts.VariableDispenser.LockForRead("ErrorDescription")
Dts.VariableDispenser.LockForRead("SourceName")
Dts.VariableDispenser.LockOneForWrite("Errordesc", vars)
Dts.VariableDispenser.GetVariables(vars)
errNumber = CType(vars("ErrorCode").Value, Integer)
errDescription = vars("ErrorDescription").Value.ToString()
errSource = vars("SourceName").Value.ToString()
errdesc = vars("Errordesc").Value.ToString()
vars("Errordesc").Value = errdesc + errNumber.ToString() + vbNewLine + vbNewLine + _
errDescription(+vbNewLine + vbNewLine + _
errSource)
Please note that "Errordesc" is the variable which I declared on script as readandwrite variable.
But on execution of this script I get error
Error: A deadlock was detected while trying to lock variables "User::Errordesc" for read/write access. A lock cannot be acquired after 16 attempts. The locks timed out.
any sugestion...
Please note that without ErrorDesc, the script runs successfully
View 5 Replies
View Related
Sep 20, 2007
hello all,
im looping on a folder with excel files via a script and a foreach loop, what i need to do is:
while looping if a file generate an error , to store that error in a row in a SQL table and continue with the next file.
any help is appreciated.
View 1 Replies
View Related
May 20, 2008
Hi guys,
I have a package name "Package1" and I have a few data-flow tasks in it.
whenever anything fails in the "Package1", I want to send out the failed email to alert myself.
So first step, I went to EventHandler tab, and select Executable as "Package1" and Event Handler as "OnError".
and then I added SendMailTask. I manually ran SendMailTask, failed email send to me okay.
But when I run package from Microsoft visual Studio (IDE), the package failed but it doesn't send out failed email.
Error code:
[174]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "xxx" failed with error code 0xC0202009. There may be error messages posted before this with more information on why the AcquireConnection method call failed.
Maybe I misunderstand OnError eventhandler, or I set up it wrong.
Thanks
View 6 Replies
View Related
Apr 15, 2008
I have a package which have two sequence container, first container is used to transfer data to a staging area and second sequence container is used to transfer to destination from that staging area. And I also apply transaction required to second sequence container.
There are several execute sql tasks and several data flow tasks inside two sequence container.
first sequence container( 1.execution sql task-> 2.data flow ->3.execution sql task) ->
second sequence container(4.execution sql task-> 5.execution sql task-> 6.data flow-> 7.data flow -> 8.execution sql task-> 9.data flow...)
I create ExecutionLog table which is used to log status for this package on our sql server. First this status field is null, then during this package run , it change to 'in process', and after this package finished, it change to 'success' or 'failure' depending this package can run successfully or not.
This package can be run only if status is 'success' ,'failure' or null. So I need to change this status field during package execution.
For updating package to failure, I need to add event handler to change that status using execute sql task.
First time I perform to execute sql task on onError event handler tab (this event handler is applyed on package level ) .
And for testing envent handler I use old schema version to make sure I get failure for '8 execution sql task'.
But package seems to get stuck at '8 execution sql task' inside second sequence container( always yellow when I run from ssis) and never fire envent handler. '8 execution sql task' is used to update related table.
Second time I remove onError envent handler and change to use on onTaskFailed event handler tab (this event handler is applyed on package level ) .
But everything is the same as using onError event handler except I got error output but still can not fire event.
Why '8.execution sql task' can not fire onError or onTaskFailed?
For this case what kind of event handler I need to use, what kind of level I need to apply for this event handler.
View 5 Replies
View Related
Oct 19, 2006
I have included the Send email task and sending email from SSIS package on Error event.
But for an error I am receiving multiple atleast 10-15 email generated. i got only 2 emails with revelant error message and other email gives message like "
Thread "WorkThread1" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown."
I have included ''@[System::ErrorDescription]' as an email attachment.
Is there any way to get only specific relevant error email.
Please suggest
View 8 Replies
View Related
Aug 10, 2006
Hi,
I want insert data into table from csv file, so I put a data flow task on control flow tab,
a flat source and a ole db dest on data flow tab. They work well.
Then to get the error log I put a script task on event handler tab, in this script task I want to
output the error description to a txt file while the data flow task fails for any reasons
such as constraint failure etc.
In this script task I think I can get the error description by using property Err.Description,
but Err.Description is empty while data flow task fails.
How can I get the error description in the script task on event handler tab.
thanks!
View 3 Replies
View Related
Nov 2, 2006
I used onError event to send email in case ssis pckage fails
but it send multiple email with errordescription. for ex below are the errordescription of four diferent emails i received.
Thread "WorkThread0" has exited with error code 0xC0047039.
An error occurred with the following error message: "The connection "{01AF859A-CF97-4F6C-9C78-1AA4B1C9C27B}" is not found. This error is thrown by Connections collection when the specific connection element is not found.".
Thread "SourceThread0" has exited with error code 0xC0047038.
The PrimeOutput method on component "Flat File Source - Read from source file" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
Can anyone suggest if we can combine all this error description and send this as one email.
View 2 Replies
View Related
May 22, 2006
I have a SSIS package which takes excel spreadsheets (exported from MS Project) and imports them into tables in my database. I have each step of my control flow set up with "On Success" so it only continues if the previous step was successful.
My next step is to create a asp.net page and/or web part so that I can have my user click a button to launch this SSIS and import this data. I have seen articles on how this could be done via code - so I assume it can be done. But what I cannot find is how alert the user if an error has occured in the execution of the SSIS.
How can you alert a user that a package you executed though vb.net in the front end errored?
Could I build something in to the OnError handler that returns the error and have that error returned to the front end App??
Any insight/examples for this would be much appreciated.
Thanks.
View 1 Replies
View Related
Apr 15, 2004
Dear All:
I want to ask how can I handle OnError events in stored procedure in MSSQL.
Actually I wanted to place some Rollback procedure on this.
Can you suggest some methods for me?
KEVIN
View 1 Replies
View Related
Nov 12, 2007
Hi all,
I have a Script Task in an OnError EventHandler, the Script Task is used to send an Email to notify about the Execution Error. I'm currently using the System:ErrorDescription variable in my Script Task to provide details about the error but I have noticed that the Error Description written in the Windows Event Log when using OnError Logging is much more detailed than the content of the System:ErrorDescription variable. How can I use the same Error Description in my Script Task ?
I'll appreciate any help.
View 5 Replies
View Related