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)
 DTS Transformation Script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-27 : 12:35:37
Steve writes "I'm having a problem transforming a column of text into a SQL 2000 table. The date in the text file is in string format and it needs to be transformed into a datetime type in the database. I keep getting a syntax error in the script when it tries to transform the string. The code breaks down the string using vbscript functions. Here's the code:

Function Main()
DTSDestination("Division") = DTSSource("Col001")
DTSDestination("GLAccount") = DTSSource("Col002")
DTSDestination("PayDate") = DTSSource(formatdatetime(year(left("Col003",4)) & month(mid("Col003",5,2)) &
day(right("Col003",4))))
DTSDestination("SourceCode") = DTSSource("Col004")
DTSDestination("WeekEndDate") = DTSSource("Col005")
DTSDestination("Amount") = DTSSource("Col006")
DTSDestination("DebitCreditFlag") = DTSSource("Col007")
Main = DTSTransformStat_OK
End Function

Can anyone see a problem here and is there an easier way to do it?

Thanks"
   

- Advertisement -