dbTalk Databases Forums  

MySQL varchar to SQL Server datetime when NULL

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


Discuss MySQL varchar to SQL Server datetime when NULL in the microsoft.public.sqlserver.dts forum.



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

Default MySQL varchar to SQL Server datetime when NULL - 07-21-2005 , 05:46 AM






I use this script to convert a MySQL varchar to a SQL Server datetime

Function Main()
data_source = DTSSource("field_name_in_mysql_table")

If (IsEmpty(data_source) Or IsNull(data_source)) Then
data_destination = Null
Else
data = data_source
data_splitted = Split(data,"-")
data_destination = data_splitted(2) & "/" & data_splitted(1) & "/" &
data_splitted(0)
End If

DTSDestination("field_name_in_SQLS_table") = data_destination

Main = DTSTransformStat_OK
End Function

All is good while there is at least one varchar NOT NULL in MySQL
table, BUT
if all the value in DTSSource("field_name_in_mysql_table") are NULL i
get an error of "Conversion not supported";

Where is my mistake?

Thank you


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.