![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
What is the syntax to convert varchar to datetime in ActiveX? Again, my source field is varchar and destination field is datetime. I tried using CDate and it didn't work. I'm not very familiar with ActiveX. Thanks in advance for your help. Function Main() DTSDestination(CDate("COL1")) = DTSSource("COL1") Main = DTSTransformStat_OK End Function |
#3
| |||
| |||
|
|
In message <59e101c40082$b4d34670$a001280a (AT) phx (DOT) gbl>, Olivia anonymous (AT) discussions (DOT) microsoft.com> writes What is the syntax to convert varchar to datetime in ActiveX? Again, my source field is varchar and destination field is datetime. I tried using CDate and it didn't work. I'm not very familiar with ActiveX. Thanks in advance for your help. Function Main() DTSDestination(CDate("COL1")) = DTSSource("COL1") Main = DTSTransformStat_OK End Function Try - DTSDestination("COL1").Value = CDate(DTSSource("COL1").Value) This still may not work because VBScript does not accept some string formats that SQL for example would, e.g. yyyymmdd. If you varchar date is something that VBScript does not like then you will need to perform some string manipulation, using functions like Left, Right and Mid to build up a suitable date format. Write a simple test script in an ActiveX Script Task, e.g. Dim sDate Dim dDate sDate = "20010101" dDate = CDate(sDate) The above will of course fail, but you can quickly test conversions in this way. -- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com PASS - the definitive, global community for SQL Server professionals http://www.sqlpass.org |
![]() |
| Thread Tools | |
| Display Modes | |
| |