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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Help Using RegExp in a DTS Transformation

Author  Topic 

getanothername
Starting Member

4 Posts

Posted - 2005-04-13 : 18:23:04
I'm still in learning mode with regular expressions and am attempting a few things during a Trasformation task from one table to another. Basically what I'm trying to to is this: during the copy/import from one table to another, I'm trying to somewhat validate an email field. When it returns valid I want it mapped directly to the corresponding column in the destination, but when it doesn't match to the expression, I want it moved to a different column. What I've got so far is this:

Function Main()

Dim objRE
Dim strExample
set objRE = new RegExp
objRE.Pattern = "^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$"
strExample = TRIM( DTSSource("CAP_EMAIL") )
' Test if a match is found
If objRE.Test(strExample) = True Then
DTSDestination("CAP_EMAIL") = DTSSource("CAP_EMAIL")
Else
DTSDestination("invalidCapEmail") = DTSSource("CAP_EMAIL")
End If
Set objRE = Nothing

Main = DTSTransformStat_OK
End Function

It keep returning the following error: ActiveX Scripting Transform '<DTS Testing Transformation>': Function 'reg' was not found in the script.

Any help would be appreciated.

-Dan
   

- Advertisement -