dbTalk Databases Forums  

Imports a new file each day

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Imports a new file each day in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark
 
Posts: n/a

Default Imports a new file each day - 07-07-2004 , 01:54 PM







How do I apply the import a new file created each day to a
DTS package?

Listed below is the information from SQLDTS website.

But I do not understand how to apply this to my DTS
package.

I created by click on Text File (Source) the properties
Existing (Text File (Source)), DataSource(Text File ),
File Name:

Please help me this problem.

Thanks,

Mark


http://www.sqldts.com/default.aspx?200

' Pkg 200
Option Explicit

Function Main()
Dim oConn, sFilename

' Filename format - exyymmdd.log
sFilename = "ex" & Right(Year(Now()), 2)
If Month(Now()) < 10 Then sFilename = sFilename
& "0" & _
Month(Now()) Else sFilename = sFilename & Month
(Now())
If Day(Now()) < 10 Then sFilename = sFilename & _
"0" & Day(Now()) Else sFilename = sFilename &
Day(Now())
sFilename = DTSGlobalVariables
("LogFilePath").Value & _
sFilename & ".log"

Set oConn = DTSGlobalVariables.Parent.Connections
("Text File (Source)")
oConn.DataSource = sFilename

Set oConn = Nothing

Main = DTSTaskExecResult_Success
End Function


Reply With Quote
  #2  
Old   
Steve Thompson
 
Posts: n/a

Default Re: Imports a new file each day - 07-07-2004 , 02:05 PM






You'll need to specify a name for your text file and a specific location.
Build your DTS package specifying the file name and location, then you'll
need to replace the file (I've used FTP), and schedule your DTS update to
run after the text file is replaced.

Steve
"Mark" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
How do I apply the import a new file created each day to a
DTS package?

Listed below is the information from SQLDTS website.

But I do not understand how to apply this to my DTS
package.

I created by click on Text File (Source) the properties
Existing (Text File (Source)), DataSource(Text File ),
File Name:

Please help me this problem.

Thanks,

Mark


http://www.sqldts.com/default.aspx?200

' Pkg 200
Option Explicit

Function Main()
Dim oConn, sFilename

' Filename format - exyymmdd.log
sFilename = "ex" & Right(Year(Now()), 2)
If Month(Now()) < 10 Then sFilename = sFilename
& "0" & _
Month(Now()) Else sFilename = sFilename & Month
(Now())
If Day(Now()) < 10 Then sFilename = sFilename & _
"0" & Day(Now()) Else sFilename = sFilename &
Day(Now())
sFilename = DTSGlobalVariables
("LogFilePath").Value & _
sFilename & ".log"

Set oConn = DTSGlobalVariables.Parent.Connections
("Text File (Source)")
oConn.DataSource = sFilename

Set oConn = Nothing

Main = DTSTaskExecResult_Success
End Function




Reply With Quote
  #3  
Old   
Ozone
 
Posts: n/a

Default Re: Imports a new file each day - 07-07-2004 , 07:43 PM



Or if you can dynamically generate the name based on a date, and other
variables, you can use a dynamic variable to set the file name. If this is
not possible, then you will need to ensure that they file name used in the
DTS package stays the same from day to day...

HTH
Ozone
"Steve Thompson" <stevethompson (AT) nomail (DOT) please> wrote

Quote:
You'll need to specify a name for your text file and a specific location.
Build your DTS package specifying the file name and location, then you'll
need to replace the file (I've used FTP), and schedule your DTS update to
run after the text file is replaced.

Steve
"Mark" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message
news:27e3c01c46453$d9946220$a601280a (AT) phx (DOT) gbl...

How do I apply the import a new file created each day to a
DTS package?

Listed below is the information from SQLDTS website.

But I do not understand how to apply this to my DTS
package.

I created by click on Text File (Source) the properties
Existing (Text File (Source)), DataSource(Text File ),
File Name:

Please help me this problem.

Thanks,

Mark


http://www.sqldts.com/default.aspx?200

' Pkg 200
Option Explicit

Function Main()
Dim oConn, sFilename

' Filename format - exyymmdd.log
sFilename = "ex" & Right(Year(Now()), 2)
If Month(Now()) < 10 Then sFilename = sFilename
& "0" & _
Month(Now()) Else sFilename = sFilename & Month
(Now())
If Day(Now()) < 10 Then sFilename = sFilename & _
"0" & Day(Now()) Else sFilename = sFilename &
Day(Now())
sFilename = DTSGlobalVariables
("LogFilePath").Value & _
sFilename & ".log"

Set oConn = DTSGlobalVariables.Parent.Connections
("Text File (Source)")
oConn.DataSource = sFilename

Set oConn = Nothing

Main = DTSTaskExecResult_Success
End Function






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.