dbTalk Databases Forums  

Using wildcard..?

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


Discuss Using wildcard..? in the microsoft.public.sqlserver.dts forum.



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

Default Using wildcard..? - 07-02-2003 , 03:21 AM






Hi all,

I have a file that looks like:
123456.pms03071
The first part, 123456, is unpredictable.
The second part is pmsYYMMDD.

What I want to do is to load the file with todays suffix.
How can I do this in a simple manner?

I have a path in a DTS-package that looks like:
sFilename = "d:\path\*.PMS" & Right(Year(Now()), 2)
....
sFilename = DTSGlobalVariables

If I use the wildcard '*' I'll get:
The filename.....is incorrect.

If I use the full filename then it works!

How can I get the wildcard to work?


/Kent J.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Using wildcard..? - 07-02-2003 , 04:21 AM






You cannot use wildacrds when specifying a file for a DTS connection. You
could use some ActiveX Script Task to find the correct file and then set teh
connection correctly.

' Delete File
Option Explicit

Function Main()

Dim oFSO
Dim oFolder
Dim oFile
Dim sFolder
Dim sFile
Dim sMatch

sFolder = "C:\"
sMatch = ".PMSDATEHERE"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sFolder)

For Each oFile In oFolder.Files
If InStr(oFile.Name, sMatch) > 0 Then
sFile = oFile.Name
Exit For
End If
Next


Set oFile = Nothing
Set oFolder= Nothing
Set oFSO = Nothing

If sFile = "" Then
MsgBox "No file found"
Else
MsgBox "Found: " & sFile
End If

Main = DTSTaskExecResult_Success
End Function


"Kent Johnson" <anonymous (AT) devdex (DOT) com> wrote

Quote:
Hi all,

I have a file that looks like:
123456.pms03071
The first part, 123456, is unpredictable.
The second part is pmsYYMMDD.

What I want to do is to load the file with todays suffix.
How can I do this in a simple manner?

I have a path in a DTS-package that looks like:
sFilename = "d:\path\*.PMS" & Right(Year(Now()), 2)
...
sFilename = DTSGlobalVariables

If I use the wildcard '*' I'll get:
The filename.....is incorrect.

If I use the full filename then it works!

How can I get the wildcard to work?


/Kent J.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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.