dbTalk Databases Forums  

Is it a bug? (Date Type Converting)

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


Discuss Is it a bug? (Date Type Converting) in the microsoft.public.sqlserver.dts forum.



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

Default Is it a bug? (Date Type Converting) - 07-15-2003 , 05:09 PM






Hi,

I wrote the following VB Script code to import data from
Access 2000 table "Time" column:

-----------------------------------------------------------
Function Main()
if (DTSSource("Time") < 1/1/1754) then
DTSDestination("Time") = "2/2/2079"
else
DTSDestination("Time") = DTSSource("Time")
end if
Main = DTSTransformStat_OK
End Function
----------------------------------------------------------

Date late then "1/1/1900" converted corretly
"1/1/1800" converted into "2/2/2079"
"1/1/1755" converted into "2/2/2079"

Why

Best Regards,

Henry


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Is it a bug? (Date Type Converting) - 07-16-2003 , 02:42 AM






OK So let's build up a structure here

Access 2000 Table

col1 number autonumber
WhenHappened time

SQL Server table

CREATE TABLE AccessDestination(col1 int, col2 smalldatetime)


Now change your internal script to be

Function Main()

DTSDestination("col1") = DTSSource("col1")

IF DTSSource("WhenHappened") < #1/1/1754# THEN
DTSDestination("Col2") = "2/2/2079"
ELSE
DTSDestination("col2") = DTSSource("WhenHappened")
END IF

Main = DTSTransformStat_OK

End Function

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Henry" <shayux80 (AT) aut (DOT) ac.nz> wrote

Quote:
Hi,

I wrote the following VB Script code to import data from
Access 2000 table "Time" column:

-----------------------------------------------------------
Function Main()
if (DTSSource("Time") < 1/1/1754) then
DTSDestination("Time") = "2/2/2079"
else
DTSDestination("Time") = DTSSource("Time")
end if
Main = DTSTransformStat_OK
End Function
----------------------------------------------------------

Date late then "1/1/1900" converted corretly
"1/1/1800" converted into "2/2/2079"
"1/1/1755" converted into "2/2/2079"

Why

Best Regards,

Henry




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.