Combining Date and Time in DTS To Make a DT_DBTIMESTAMP datetime

I was recently dealing with importing a DBISAM (Btrieve) database to SQL Server, which had separate date and time columns where I wanted to import a DateTime.  Using the ODBC driver and a DataReader data source, it was returning the date as the DT_DBTIMESTAMP type and the time as a DT_I8 long integer.

I tried using the Derived Column transformation to combine them, but never could get it to work.  There simply aren’t many date functions supported by the Derived Column formulas.  Finally, I settled on using the following VBS script using the Script Component transformation:

If Not Row.StartDate_IsNull Then
    If Row.StartTime_IsNull Then
        Row.StartDateTime = Row.StartDate
        Row.StartDateTime = Row.StartDate.AddTicks(Row.StartTime)
    End If
End If

Creating GUID Derived Column in DTS

If you want to add a constant GUID to a table during a DTS transformation, it’s a little tricky.  Here’s the solution.

Use the Derived Column transformation in order to add a new column.  For the formula, use the GUID surrounded by double quotes.  The trick is that you MUST include the curly braces, like so:


Then set the type of the column to unique identifier (DT_GUID).  That’s it.