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
 Need help using wild cards in DTS

Author  Topic 

dips
Starting Member

1 Post

Posted - 2005-11-28 : 10:15:03
Hi All

I am new to SQL Server, DTS etc... But here is the question I have:

I have some files in a folder which have a the yr, month, date appended at the end, for e.g. testfile2005_11_28.log
In a folder I have to look for the log files which are named
testfileYYYY_MM_DD.log.

Dim item
For Each item In logFolder.Files
If (UCASE(item.Name) like ("TESTFILE" +"[0-9][0-9][0-9][0-
9]"+"_"+"[0-12][0-12]"+"_"+"[0-3][0-9]" + ".log") )Then
msgbox item.Name
End For

I am getting compilation error: "Sub or Function not found" in the If
statement. Can anyone please help me?

Thanks,
D

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2005-11-28 : 18:07:43
Hi D

statement looks alright to me, but you don't need to use UCASE if you're using like - its already case insensitive.

Do you have an "end if" for your "if"? Its a bit hard to tell with the formatting whether you are trying to use the single-line version of the "if" statement or not.

suggestion - try doing the for each without the if, and see if you get an error or not, then put in a simple if (eg if True Then) and see what you get, then try a simple "like" (eg if "a" like "A" then) and see what you get etc - build it up slowly and then you can tell us exactly what's failing - its possible that your DTS is missing a reference to the VBScript language library or something....?

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -