Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert from varchar to datetime, DTS 1

Status
Not open for further replies.

ersatz

Programmer
Oct 29, 2002
114
US
Hi,

I must transfer an oracle table to sql server with DTS.

A column is varchar type in the oracle table and is datetime in sql server table.

For the transformation I use this:

DTSDestination("col_date") = convert(datetime,DTSSource("col_date"),1).

When I run the DTS I have this error:

the number of failing rows exceeds the maximum specified.
error source:Microsoft VBScript runtime error
Error description: Type mismatch:'convert'

Could you tell me please what is wrong with my DTS&
Many thanks
 
Try using the CDate command

CDate(DTSSource("col_date"))

Because the source field is a varchar you could ensure that it is a valid date coming through - you can do this with the IsDate function as below:

If IsDate(DTSSource("col_date")) Then
DTSDestination("col_date") = CDate(DTSSource("col_date"))
End If
 
Hi TomKane,
Thanks very much for your response. You helped me to solve the problem!
 
Hi,

You're very welcome. Thanks for the star - it's much appreciated.

Regards,
Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top