March 30, 2005 at 4:50 am
Hello,
Does someone know how to execute a braunch in "data transformation service" only if a text file, wich is used to fill a table, is not empty ?
I also would like to have a mail send to me if the text file is empty.
Please help it drive me crazy
March 30, 2005 at 1:22 pm
I will do it as a VBscript The type of the Task is ActiveX Script Task.
Create FileSystemObject File object and check its size. Or if you think that the first line will contain a header, then actually open the file and do 2 ReadLines checking if the second one is empty. Then based on the output use the script that sends an email or use your regular SendMail SP or SMTP XP whatever is applicable in your case.
Yelena
Regards,Yelena Varsha
March 31, 2005 at 1:16 am
You could implement a logic similiar to the looping logic for DTS using the DTSStepExecStatus constants and some script code that checks if the text file is not empty and applies DTSStepExecStat_Waiting to the step's ExecutionStatus property respectively DTSStepExecStat_Inactive if the text file is empty (I normally do this with variables and a dynamic properties task for the sake of laziness).
April 4, 2005 at 1:55 am
thank's,
does someone have a snipped of code ? i am newbe in vb script. or maybe know where i can find a good tutorial that explains how to use vb script in active x for DTS ?
April 6, 2005 at 1:03 pm
April 6, 2005 at 4:04 pm
Not sure what you mean.
The code looks like
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile("c:\test.txt")
Determining if the file is empty might work by checking the size (f1.size = 0). If you have a text file and you want to check if you have no rows check out the OpenTextFile method of the FSO.
For more information check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp. The object you would need is the FileSystemObject.
Rgs.
April 7, 2005 at 9:32 am
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply