January 3, 2007 at 7:07 am
i am trying to do a simple transformation through DTS.
My source column TreatyNumber has values like
MRQYP2C2
MRQYP3C2
MRQYP2C2
what i want to do is take the 6th Digit which will be a 2 in the first instance (MRQYP2C2)
and put it in my destination column which is TreatyID.I need to know only how to write
VB script for this transformation.
'**********************************************************************
' Visual Basic Transformation Script
'************************************************************************
' Copy each source column to the destination column
Function Main()
DTSDestination("TreatyID") = DTSSource("TreatyNumber")
Main = DTSTransformStat_OK
End Function
January 3, 2007 at 7:30 am
Do you expect the format of the TreatyNumber to remain the same in the future. I.e. do you expect the length of the treatyNumber to change ever?
If not, you could simply use the following
DTSDestination("TreatyID") = Mid(DTSSource("TreatyNumber"), 6, 1)
The MID function is basically the same as the SUBSTRING function in TSQL. I hope this helps
SQL guy and Houston Magician
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply