dbTalk Databases Forums  

Unable to convert MySQL date to SQL Server smalldatetime using DTS

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


Discuss Unable to convert MySQL date to SQL Server smalldatetime using DTS in the microsoft.public.sqlserver.dts forum.



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

Default Unable to convert MySQL date to SQL Server smalldatetime using DTS - 03-03-2006 , 10:36 AM






Hello,
I am using a DTS package to import tables from MySQL to SQL Server
2000. All works fine except tables that have date type columns (MySQL).
The format is YYYY-MM-DD. The receiving fields in MS SQL are
smalldatetime. I am getting the following error: ....general conversion
failure on column pair ... (source column 'end_date' (DBTYPE_DBDATE)),
(destination column 'end_date' (DBTYPE_DBTIMESTAMP).

I then used ActiveX script to convert the dates:

'************************************************* ***************
' Visual Basic Transformation Script
'************************************************* ***************

' Copy each source column to the destination column
Function Main()

dim i_Day
dim i_Month
dim i_Year


i_Day = Cint(Mid( DTSSource("start_date") ,9 , 2 ))
i_Month = Cint(Mid( DTSSource("start_date") ,6 , 2 ))
i_Year = Cint(Left(DTSSource("start_date"),4))

DTSDestination("start_date") = DateSerial( i_Year , i_Month ,i_Day )
Main = DTSTransformStat_OK
End Function
************************************************** **************

I get an error: ......Error description: Type mismatch: 'DTSSource'.

Then I tried casting in Transform Data Task:

select
`program_id`,`campaign_id`,`program_name`,`descrip tion`,cast(`start_date`
as datetime),cast(`end_date` as datetime) from `factivaupd`.`programs`

I am getting a different error: ....insert error, column 6('end_date',
DBTYPE_DBTIMESTAMP), status 6: data overflow. Invalid character value
for cast specification.

I have not clue why convertion can not happen. Any help will be greatly
appreciated.

Thanks,
Stan


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.