![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have written an activex script to disable a data transform task when the file size is zero and put it in the work flow properties ti not run a task of uplaod if the file size is zero. The script is as given below.. Function Main() Dim fso Dim f Dim FileName ' file to check for a zero-byte length FileName = "\\nbcprddb2\groupsdw\NBC_IM_Data\DataFiles\RawDat aFiles\FTP_HandTools\SAP40 |
|
Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(FileName) ' if it's zero bytes, don't import it or the import ' will fail If f.Size = 0 Then Main = DTSStepScriptResult_DontExecuteTask Else Main = DTSStepScriptResult_ExecuteTask End If Set f = Nothing Set fso = Nothing End Function I also want to intimate the dba that the file size is zero..either by executing xp sendmail or by using the send mail functionlity of dts if the task does not execute.How do I get this done if the task is not executed when the file size is zero. Thansk Ajay Garg |
#3
| |||
| |||
|
|
Change the placement of the "File size is Zero Logic to incorporate this Multiple Paths in Workflow (http://www.sqldts.com/default.aspx?218) you disable/enable each flow as necessary -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Ajay Garg" <ajayz90 (AT) hotmail (DOT) com> wrote in message news:d9477327.0311071101.130c6a09 (AT) posting (DOT) google.com... I have written an activex script to disable a data transform task when the file size is zero and put it in the work flow properties ti not run a task of uplaod if the file size is zero. The script is as given below.. Function Main() Dim fso Dim f Dim FileName ' file to check for a zero-byte length FileName = "\\nbcprddb2\groupsdw\NBC_IM_Data\DataFiles\RawDat aFiles\FTP_HandTools\SAP40 \adrc_chng.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(FileName) ' if it's zero bytes, don't import it or the import ' will fail If f.Size = 0 Then Main = DTSStepScriptResult_DontExecuteTask Else Main = DTSStepScriptResult_ExecuteTask End If Set f = Nothing Set fso = Nothing End Function I also want to intimate the dba that the file size is zero..either by executing xp sendmail or by using the send mail functionlity of dts if the task does not execute.How do I get this done if the task is not executed when the file size is zero. Thansk Ajay Garg |
#4
| |||
| |||
|
|
Thanks Allan... for yor response but I am a newbie to VB scripting.I had read your article in context to this problem but could not think up the specificts as to how to implement this in this particular case.I specifically do not get how i can define a sub in the gloal main procedure .....again having done this ...where should i define my global variables and how should i treat it in the work flow... I apologise butI am a back end guy and have just been able to piece together this bit..I found scripting usefulbut am not able to proceed as i am new to the lnguage...would be obliged if you could guide mt hrough the steps. Thanks Ajay "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote Change the placement of the "File size is Zero Logic to incorporate this Multiple Paths in Workflow (http://www.sqldts.com/default.aspx?218) you disable/enable each flow as necessary -- -- Allan Mitchell (Microsoft SQL Server MVP) MCSE,MCDBA www.SQLDTS.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Ajay Garg" <ajayz90 (AT) hotmail (DOT) com> wrote in message news:d9477327.0311071101.130c6a09 (AT) posting (DOT) google.com... I have written an activex script to disable a data transform task when the file size is zero and put it in the work flow properties ti not run a task of uplaod if the file size is zero. The script is as given below.. Function Main() Dim fso Dim f Dim FileName ' file to check for a zero-byte length FileName = "\\nbcprddb2\groupsdw\NBC_IM_Data\DataFiles\RawDat aFiles\FTP_HandTools\SAP40 \adrc_chng.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(FileName) ' if it's zero bytes, don't import it or the import ' will fail If f.Size = 0 Then Main = DTSStepScriptResult_DontExecuteTask Else Main = DTSStepScriptResult_ExecuteTask End If Set f = Nothing Set fso = Nothing End Function I also want to intimate the dba that the file size is zero..either by executing xp sendmail or by using the send mail functionlity of dts if the task does not execute.How do I get this done if the task is not executed when the file size is zero. Thansk Ajay Garg |
![]() |
| Thread Tools | |
| Display Modes | |
| |