Package Does Not Stop When Supposed To
Nov 19, 2007
Hi,
I have a package with For Loop container.
It looks like this:
FOR LOOP (until @IsCurrent < 1) [
[Execute Package Task 1] --> [Execute Package Task 2] --> [Execute SQL Task] --expression--> [Script Task]
]
So, in the [Execute SQL Task], it runs a stored procedure, which returns a 0 or 1 value, which is bound to the variable @IsCurrent. The variable then gets evaluated in the "expression." If @IsCurrent is 0, execution continues to the [Script Task]. That part works fine.
The problem is occurring in the [Script Task] portion. All the Script Task does is "sleep" for 3 minutes. Here is an excerpt of the code:
Dts.Variables("sleepCounter").Value = CInt(Dts.Variables("sleepCounter").Value) + 1
If CInt(Dts.Variables("sleepCounter").Value) = 20 Then
Dts.TaskResult = Dts.Results.Failure
Exit Sub
End If
So, as you can see, if "sleepCounter" = 20, it fails the task, which should then fail the package, right??
However, the package keeps running, even after sleepCounter has exceeded 20. The MaximumErrorCount on the For Loop container is set to 20 also. So after 20 failures, this package should fail, but it isn't!
Any ideas?
Thanks
View 9 Replies
ADVERTISEMENT
May 26, 2006
Hi,
In one of my packages, I have a script component to do a transformation and I am inserting the output to table. Within that script component, if the data does not match my requirement, I have to stop the job. For that, I am using 'componentmetadata.fireError' to raise an error. The problem is, now even when an error is raised, the job completes by loading the remaining records and then aborts. But I want to abort the job as soon it raises an error. How to do this?
Thanks.
View 8 Replies
View Related
May 6, 2008
I'm trying to stop a DTS package from continuing to run after the result of the following ActiveX script:
Function Main()
If day(date) > 2 and day(date) < 10 and weekday(date) = 2 Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End if
End Function
Any help would be appreciated.
View 2 Replies
View Related
Aug 2, 2006
Hello all
I want to cause the package to fail in DataFlow. I wanted use the script component for this purpose.
How I can do it?
Thanks
View 1 Replies
View Related
Jan 16, 2007
I have a MSSQL DTS Package where it needs to loop/execute 3 times because the main task is to import data from 3 excel files (different location) into 1 SQL table. I used a global variable vCounter and I use an ActiveX Script.
ActiveX Script 1
Option Explicit
Function Main()
Dim vDate, vCounter, vBranchCode, vPath
vDate="011207"
vCounter=DTSGlobalVariables("gVarCounter").Value
IF vCounter<=3 THEN
IF vCounter=1 THEN
vBranchCode="ALB"
vPath="D:PROJECTSHRISALB"
ELSEIF vCounter=2 THEN
vBranchCode="MOA"
vPath="D:PROJECTSHRISMOA"
ELSEIF vCounter=3 THEN
vBranchCode="PSQ"
vPath="D:PROJECTSHRISPSQ"
END IF
DTSGlobalVariables("gVarPath").Value=vPath & vDate & "_" & vBranchCode & ".xls"
Main = DTSTaskExecResult_Success
ELSE
<This is where i will initialize the global variable gVarCounter, so in the next execution..the value should be back to 1>
DTSGlobalVariables("gVarCounter").Value=1
<DTS Process should stop execution...how is this?>
END IF
End Function
After excel to sql dts
ActiveX Script2
Function Main()
IF gVarCounter<=3 then
DTSGlobalVariables("gVarCounter").Value=DTSGlobalVariables("gVarCounter").Value+1
DTSGlobalVariables.Parent.Steps("DTSStep_DTSActiveScriptTask_1").ExecutionStatus=DTSStepExecStat_Waiting
Main = DTSTaskExecResult_Success
END IF
End Function
Thanks a lot.
View 4 Replies
View Related
Aug 8, 2007
Hi,
Simple question, is there a way to stop a package validating itself when i open it in visual Studio ?
I still want it to validate when i run, but not when i open it to view as its sooooooooooo slow....
any help is much appreciated?
Regards
Chris
View 3 Replies
View Related
Mar 27, 2007
HELLO,
I want to create a package which start and stop the SQL server's services... i know i can achive this via NET COMMAND.... but i coudnt find in which task (SSIS) I can place that command?..
I also came across that I can achieve this using Execute Process task but for this I have to define executable file.... actually i dont want ne thing outside from my SSIS package
CAN I ACHIEVE THIS WITH IN SSIS PACKAGE?
is there ne other alternative?
regards,
Anas
View 9 Replies
View Related
Apr 17, 2008
Hi All,
I have some clarifications on stopping my package once cube is refreshed or processed.
Below i have given steps for the transformation in my package
Let me give you what are all the dataflow transformations that i had given in my package.
1. Data Flow Task
2. Script Task 1- I have written code for getting the last processed cube (global variable has been declared for Last processed cube date - lastProcessedCube)
3. Script Task 2 - I have written code for SS_Batch table where i can get Create_Ts date that is assigned to another global variable - create_ts.
4. Analysis Processing Task.
In between Script Task 2 and Analysis Processing Task i have given @lastProcessedCube > @create_ts for Expression and Constraint under Precedence Constraint Editor
Actually i need to run package for every 10 minutes which i can do it in Job Schedule and need to refresh or process the cube daily. Is there any way to stop the package once when my cube is processed on that day. Again start the package for the next day.... Is it possible to do this? Please let me know.
Thanks in Advance,
Anand Rajagopal
View 14 Replies
View Related
Sep 13, 2006
Hi everyone,
After a Execute method I would need to stop a package but I don't know why:
sResultDts = pkg.Execute(Nothing, Nothing, EventsSSIS, Nothing, Nothing)
I have a Events class (EventSSIS) which implements IDTSEvents and have an OnQueryCancel event but without parameters, such so:
Function OnQueryCancel() As Boolean Implements IDTSEvents.OnQueryCancel
Return False
End Function
Let me know how to pass a boolean parameter because of I can't overloaded OnQueryCancel method
TIA-
View 1 Replies
View Related
Sep 8, 2015
I am using SQL Server 2012 SP1. I have built an SSIS package that imports flat file data from various files to SQL Server. I have got it to do everything I want it to do when things are going well, and am now on what I want it to do when it encounters a failure executing specific tasks and containers. For example, I have a Foreach Loop container that executes a dedicated stored procedure for each csv file in the target folder. If any of the store procedures fail to run for any reason I want to carry out certain actions.
For the most part I think I will be fine using the Event Handlers. What I can't seem to find is how to tell the package to stop executing on a Failure event after carrying out the actions defined by the relevant Event Handler. Or, perhaps it isn't necessary as that would be the default behaviour on a failure?
View 2 Replies
View Related
Jan 4, 2007
Hi everyone,
I've created a DTS package runs on every day and night, but now my boss was asking if I can insert an exception code to check the view file.
So.. I need help from you guys, cause I don't know How.
This is my DTS description.
My DB will generate a view called "Calls to Add", then it will run the Transform Data Task and insert into a txt file. once it finished, it will run the Batch file. that is it.
Now My boss wants me to add a checking code between "View to Txt" procedure. If the view has no record inside, than the DTS package should stop and not run.
BUT How??? Can someone please help?? Thanks
View 10 Replies
View Related
Aug 1, 2006
Hi,
I need to make my package check a variable value at the begining of the execution and depending on the value of that variable it decides either to continue or stop the package execution. How can i do that?
thanks,
Aref
View 1 Replies
View Related
Jul 17, 2007
[Microsoft follow-up]
All,
According to BOL the ForceExecutionResult property can be used to imitate real-time failure (http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtsforcedexecresult.aspx).
However, I've just done a very simple test and this appears to not be the case. Here's the repro:
Start a new package
Drag on a Sequence Container
Set the sequence container property ForceExecutionResult='Failure'
When you run the package the sequence container will complete successfully. As far as I can see its not supposed to.
Any comments?
Thanks
Jamie
View 10 Replies
View Related
Apr 10, 2008
Hi, this is my first post and I'm relatively new to SSIS so please go easy on me.
Without going into too much detail about it, I've set up a simple SSIS package which does this in a nutshell:
Foreach loop picks up all *.xls files in a given folder
1 - Puts the name of the current spreadsheet into a variable
2 - File System Task copies the current spreadsheet ("abc.xls") to a file called "work.xls"
3 - Data Flow task performs data extraction on "work.xls" and puts it into a SQL server database
4 - File System Task moves "abc.xls" into a "success" folder
Continues with loop - move onto next spreadsheet
This works fine, so long as the spreadsheets all have the same number of columns.
As soon as one of them has a column missing (believe me, this will happen - we're dealing with users here) the package falls over at step 3.
When the package comes across an erroneous spreadsheet, what I'd like to do is move the offending file to a failure folder (making step 4 either a success or failure file move) and carry on with the next one.
I know that you can have an error path (the red line) from any step within the dataflow task, but this doesn't help me because the error lies in the structure of the spreadsheet and not the contents.
I've already come up with a work around whereby each file is moved into the failures folder just after step 2, then moved from the failures folder into the success folder at step 4.
This almost gives me what I want, although of course the package still falls over whenever it encounters a dodgy looking spreadsheet.
Is there any way that I can get the package to do what I'm after?
Many thanks,
Simon
View 1 Replies
View Related
Jun 29, 2004
here's my code...
DECLARE @Output FLOAT
SELECT @Output=(@Part/@Whole)*100
When I substitute my parameters like this:
SELECT @Output=(5/20)*100
The answer is always 0.0!
But if I do this:
SELECT @Output=(5*100)/20
I get the correct answer.
Why is this so?
What is the correct way in SQL to calculate percentage??!!!
View 3 Replies
View Related
Mar 21, 2007
Hi I have completed my first SSIS master package which runs a whole lot of child packages depending on value of expressions on workflow. (refer http://www.sqlis.com/306-3.aspx)
Each of my child packages is .dtsx file location and each Excute Package task uses the file connection.
The master parent package is also a dtsx file location which will be run by a SQL Server 2005 Agent
All good--problem is testing from BIDs--each time a Excecute package task is run--turns yellow a new tab appears apears in the design window --showing you that particular .dtsx file control flow detail. DTS never had this behaviour --can I turn this off in the BIDS ie as I have dozens of new tabs at run time which makes it very hard to keep track of the master package. All I want is the master package running from BIDs, and no new tabs appearing at run time???
Thanks kindly
Dave
View 4 Replies
View Related
May 29, 2006
I€™m importing a Flat file (delimited text) into a sql server database table and trying to trap any import errors in another output Flat file.
I create a Flat File Source task. After tweaking the task, the Source €œError Output€? tab shows all the input columns and all €œError€? and €œTruncation€? values are set to €œRedirect row€?
Next I add a €œSQL Server Destination€? task and connect the Source green arrow to it.
Finally I add a Flat File Destination task (error Output task), connect the Source red arrow to it, click €œOK€? in the €œConfigure Error Output€?, and finally add a connection manager to the Error output task. When I look at the Mappings tab of the Error Output file it shows only three available input columns: €œFlat File Error Output Column€?, ErrorCode, and ErrorColumn
I€™m not sure where they came from but that info is not very useful to me. I want to know which line the error occurred on as well as the bad column(s). If nothing else, I need to see at least the actual row that was bad. How can I get that information?
Barkingdog
View 8 Replies
View Related
Mar 11, 2002
Hi All,
I'd like to remotly stop an instance of SQL Server
but this command does not seem to work....
net stop mssql$<server name> (eg. net stop mssql$prod)
...any ideas? I'll want to start this sql server again too.
David.
View 1 Replies
View Related
Jan 30, 2008
Is there any way to stop SQL CLR on database apart from using
sp_configure 'clr enabled', 1
GO
RECONFIGURE
GO
I want to stop this functionality on database...any idea...
View 1 Replies
View Related
Apr 10, 2008
Hi All I am using SQL server Database in one of my table there is a column which is set to Identity=Yes i.e., The ID is increment by one on every insert and if the insertion failed then the id generated goes off then in the next generation it uses new id ..........EXfirst insertion id=1 then in the second insertion if while adding data to other rows if i get some error then the id 2 is not used and when i correct the error and insert it then id=3? can any one give me the solution for this and NextWhen i delete the datafrom the table see the ids are upto 20 and i delete all the records from the table after insertion of new record the id will be 21plese help me in this
View 3 Replies
View Related
Feb 25, 2004
I have these two tables and I cant prevent duplicates.
SEARCH
Item
ItemID
Info
CATEGORYDATA
CategoryID
ItemID
SELECT DISTINCT SEARCH.ItemId, SEARCH.Item, CATEGORYDATA.CategoryId
FROM SEARCH
INNER JOIN CATEGORYDATA
ON SEARCH.ItemID = CATEGORYDATA.ItemID
And I get something like:ItemID Item CategoryID
1 item1 1
3 item3 1
1 item1 2 <---duplicate
1 item1 3 <---duplicate
2 item2 3
4 item4 3
Thanks in advance
View 4 Replies
View Related
Apr 29, 2002
I have a snapshot replication is running and now I want to stop the replication for a while. Is it possible to do that? If it is then where I can set to stop it? Please help.
Thanks for Help!
View 2 Replies
View Related
Apr 25, 2000
Hello,
Does any one know how I can start and stop the sql services with the net use command?
Thanks,
Anthony
View 1 Replies
View Related
Sep 1, 1998
I use EM to handle 2 SQL servers. One I can `stop`; the other I can`t. (except I think I used to be able to do so).
When I select the `stop` I get the following message from EM:
"An error 1051 - (A stop control has bee sent to a service which other running services are dependent on) occurred while performing the service operation on the MSSQLServer service."
How do I track down what this other running service is? How do I stop SQL?
All help greatly appreciated.
Judith
View 1 Replies
View Related
May 10, 2002
I need to remotely start and stop SQL from another machine from a program or command line. Thanks in advance.
View 1 Replies
View Related
Aug 29, 2002
I wanted to remove my Northwind database. But that database is currently used for replication. I'll have to stop the replication first before I can remove it.
So how to stop the replication?
Thanks!
amy
View 1 Replies
View Related
Feb 13, 2006
Hi,
Can anybody tell me how to stop the execution of a T-SQL statement at once? I have tried Alt+Break but its taking a long time to stop.Whats the reason?Plz suggest....I am dealing with a database containing 24343000 data.
Joydeep
View 5 Replies
View Related
Sep 7, 2007
Hey
I have a statement that has been running great for the past hour but now it will not pull the info any longer and just gives me a null
DECLARE @Text VARCHAR(2000)
SELECT @Text = COALESCE(@Text + '', '') + x.memotext
FROM (SELECT TOP 100 PERCENT memotext FROM customermemoheader WHERE memonumber = 'TERMS' and customernumber = '0009' ORDER BY seqnumber) AS x
SELECT @Text AS MemoText
I have verified in the tables that the info is there by running the select statement from within the (). It has worked for 8000 records and now it no longer works. Any help would be much appreciated.
THanks
View 14 Replies
View Related
Nov 30, 2007
I have a performance issue with a Cognos report against SQL Server 2005.
The total running time of the report is 1 minute 15, and using SQL Profiler I found out that 1m13 is spent preparing SQL. Execution and generating the report takes up 2 seconds; no problem there.
The SQL is the same every time I run the report, yet SQL Server spends 1m13 preparing it every single time! I'm no DBA, but as far as I understand that's not what's supposed to happen; once prepared, the SQL should execute quickly every time.
Is there a way to stop SQL from preparing the statement every time?
(Cognos 8 against SQL Server 2005 through OLEDB. Oh, and this query takes about a second when run in EM.)
View 14 Replies
View Related
Jun 29, 2015
How do you stop Replication?It is causing blocking. URLs....
View 9 Replies
View Related
Feb 26, 2008
Hey Guys, I have a question. I know you can put a 'STOP' command in VBA code. Is there something like that for SQL Server Stored Procedures?
View 3 Replies
View Related
Jul 20, 2005
Hi,I am doing some resource hungry tasks (some extraction and loadingthrough DTS), for which each time the SQL Server Log files gets filledup!Is there any way to stop the logging (like as during restore)?Thanks in advance.-surajit
View 1 Replies
View Related
Jul 20, 2005
Hi.I need to stop mssql service via command row.How can I do?Tnk,Luca
View 1 Replies
View Related