Showing posts with label scheduled. Show all posts
Showing posts with label scheduled. Show all posts

Thursday, February 16, 2012

Checking for file existance in DTS

I have a DTS package that extracts information and puts it in an ASCII file
for upload to our bank. The upload is done by a scheduled task. Since I
don't always know if this task is successful, (the file ascii file will be
deleted if it is), I need to check for the existance of this file at the
beginning of the DTS package to stop it from running if the file already
exists.
This is on SQL2000
My questions are...
1) Is there a way to check for the existance of an ascii file on the server
from inside a DTS package, and then stop the package if it exists.
2) (alternately) Is there a way to set a DTS data transformation that
copies the data from a table into the ascii file so that it will append
rather than overwritting the ascii file.
Sorry if this is a duplicate, I think I lost a previous version of this
before it was posted.
Charlietake a look at the code below I have it in an internal package that I use in
a lot of packages so that I don't have duplicate code
FolderPath = (DTSGlobalVariables("gvFolderPath").value)
FilePath = DTSGlobalVariables("gvFilePath").value
Dim FSO
Function Main()
Set FSO = CreateObject("Scripting.FileSystemObject")
MoveFile(FSO)
Main = DTSTaskExecResult_Success
End Function
Function MoveFile(FSO)
MoveFrom = FolderPath & FilePath
If FSO.FileExists(MoveFrom) Then
DTSGlobalVariables("gvPackageError").value =0
else
DTSGlobalVariables("gvPackageError").value = 1
End If
End Function
"Charlie Chisholm" <charlie.chisholm@.goodwill-suncoast.com> wrote in message
news:bJe3e.38592$Fz.5460@.tornado.tampabay.rr.com...
>I have a DTS package that extracts information and puts it in an ASCII file
>for upload to our bank. The upload is done by a scheduled task. Since I
>don't always know if this task is successful, (the file ascii file will be
>deleted if it is), I need to check for the existance of this file at the
>beginning of the DTS package to stop it from running if the file already
>exists.
> This is on SQL2000
> My questions are...
> 1) Is there a way to check for the existance of an ascii file on the
> server from inside a DTS package, and then stop the package if it exists.
> 2) (alternately) Is there a way to set a DTS data transformation that
> copies the data from a table into the ascii file so that it will append
> rather than overwritting the ascii file.
> Sorry if this is a duplicate, I think I lost a previous version of this
> before it was posted.
> Charlie
>

Tuesday, February 14, 2012

Checking at the end of the Cursor if error ocuured

I have a scheduled job which runs daily at 7:00 am. Now, this job has a
cursor in it whcih updates and inserts some tables depending on the conditions
i want to make an entry into a table called monitor (which tracks if the job
ran successfully or not) checking if the job ran successfully or not. Please
advice if their is a way to check if an error occurred or not
thanks
samay
You could create one job step that would only execute if the job step that
runs the statement fails. That job step (lets call it "run on failure")
could do whatever processing or notification that you desire if the job step
fails.
Keith
"KritiVerma@.hotmail.com" <KritiVermahotmailcom@.discussions.microsoft.com>
wrote in message news:6C8C2715-F6BB-49AF-A5CE-C69260E666CF@.microsoft.com...
> I have a scheduled job which runs daily at 7:00 am. Now, this job has a
> cursor in it whcih updates and inserts some tables depending on the
conditions
> i want to make an entry into a table called monitor (which tracks if the
job
> ran successfully or not) checking if the job ran successfully or not.
Please
> advice if their is a way to check if an error occurred or not
> thanks
> samay

Checking at the end of the Cursor if error ocuured

I have a scheduled job which runs daily at 7:00 am. Now, this job has a
cursor in it whcih updates and inserts some tables depending on the conditions
i want to make an entry into a table called monitor (which tracks if the job
ran successfully or not) checking if the job ran successfully or not. Please
advice if their is a way to check if an error occurred or not
thanks
samayYou could create one job step that would only execute if the job step that
runs the statement fails. That job step (lets call it "run on failure")
could do whatever processing or notification that you desire if the job step
fails.
--
Keith
"KritiVerma@.hotmail.com" <KritiVermahotmailcom@.discussions.microsoft.com>
wrote in message news:6C8C2715-F6BB-49AF-A5CE-C69260E666CF@.microsoft.com...
> I have a scheduled job which runs daily at 7:00 am. Now, this job has a
> cursor in it whcih updates and inserts some tables depending on the
conditions
> i want to make an entry into a table called monitor (which tracks if the
job
> ran successfully or not) checking if the job ran successfully or not.
Please
> advice if their is a way to check if an error occurred or not
> thanks
> samay

Checking at the end of the Cursor if error ocuured

I have a scheduled job which runs daily at 7:00 am. Now, this job has a
cursor in it whcih updates and inserts some tables depending on the conditio
ns
i want to make an entry into a table called monitor (which tracks if the job
ran successfully or not) checking if the job ran successfully or not. Please
advice if their is a way to check if an error occurred or not
thanks
samayYou could create one job step that would only execute if the job step that
runs the statement fails. That job step (lets call it "run on failure")
could do whatever processing or notification that you desire if the job step
fails.
Keith
"KritiVerma@.hotmail.com" <KritiVermahotmailcom@.discussions.microsoft.com>
wrote in message news:6C8C2715-F6BB-49AF-A5CE-C69260E666CF@.microsoft.com...
> I have a scheduled job which runs daily at 7:00 am. Now, this job has a
> cursor in it whcih updates and inserts some tables depending on the
conditions
> i want to make an entry into a table called monitor (which tracks if the
job
> ran successfully or not) checking if the job ran successfully or not.
Please
> advice if their is a way to check if an error occurred or not
> thanks
> samay