Data Flow, INT to Hours + DateTime

  • Hi All,

    Ok I have two columns Duration(INT) e.g.240 and StartTime(DateTime) in table SHIFT.

    First thing I need to do is convert Duration which is mins to hours, then add it to StartTime, this is easy in SQL;

    SELECT CONVERT(varchar, DATEADD(HH,Duration, 0), 114)+ StartTime

    FROM Shift

    I am trying to do this within an data flow task, so it will make a calculated field to be uploadeed into another DB in the last step of the data flow.

    I tried using a variable in a SQL task in the control flow, but you can't change the data types of variables and it didn't accept datetime as a variable type for this SQL.

    So now I am thinking I can do it in derived column editor, but I am not sure if you can or what the syntax might be. It could be a new column or override an existing doesn't matter.

    2. If using an SQL task to output to the variable then either use the variable to map to a column output or extract the data in the variable and output that?

    Can anyone help?:-D

  • If you are retrieving this from a SQL database, then why not do this calculation in SQL at the same time as retrieval?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply