convert two columns into one

  • Hello!

    How can i convert two columns (Date, Time) into one column (DateAndTIme)?

    I'm trying write a transformation in VB code..

    Thanks

    Claudia


    Regards,

    Cláudia Rego

    www.footballbesttips.com

  • Not sure if this what you are looking for but here is a VB sample:

    in T-SQL you would use convert in place of CDate and Cast/Convert in place of Cstr

    Private Sub teststuff()

        Dim a As Date

        Dim b As Date

        Dim c As String

       

        a = "12/12/2006"              'Date Value

        b = "15:30:00"                'Time Value

        c = CStr(a) + " " + CStr(b)   'Date Time Value as a string

       

        c = CDate(c)                  'Date Time Value converted

        MsgBox c                      'Just to see it populated

    '(NOTE: msgbox in DTS doesn't work)

    End Sub

    -

  • Thanks!!

    It works

    Claudia


    Regards,

    Cláudia Rego

    www.footballbesttips.com

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

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