Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 REDING FILE

Author  Topic 

hizakemi
Starting Member

33 Posts

Posted - 2007-03-22 : 09:18:37
Help.

I'm tying to get a file and push to my sql table everyday. The issue, I having is that the name of the file keep changing everyday because of the date file generated. For example, today file will be lexnex.oh00640s.20070322 but tomorrow will be lexnex.oh00640s.20070323, it is only the date that changes. How can VB script read the file? Please, see the attached script

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

dim osys
dim ofile

set osys = createobject("scripting.filesystemobject")
set ofile = osys.getfile ("\\RET4W332.AD.BANKONE.NET\dumpfiles\lexnex*)")


DTSGlobalVariables("dtm").value = ofile.datelastmodified

set ofile=nothing
set osys = nothing

Main = DTSTaskExecResult_Success

End Function

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-22 : 09:41:00
see
http://www.nigelrivett.net/SQLTsql/ImportTextFiles.html
http://www.nigelrivett.net/SQLTsql/s_ProcessAllFilesInDir.html


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -