sql syntax error with datepart??

  • Hi

    I am getting a syntax error on the following:

    case

    DATEPART(mm,APPT_RPT_APPOINTMENT.START_DATETIME)

    when 07

    then (APPT_RPT_APPOINTMENT.DURATION / 60)

    end AS Julyschedhours

    Thanks

    Joe

  • jbalbo (3/19/2013)


    Hi

    I am getting a syntax error on the following:

    case

    DATEPART(mm,APPT_RPT_APPOINTMENT.START_DATETIME)

    when 07

    then (APPT_RPT_APPOINTMENT.DURATION / 60)

    end AS Julyschedhours

    Thanks

    Joe

    This small cut-off of the code looks fine but it doesn't constitute runnable SQL.

    Please provide full query and exact error you get.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Sorry....

    I missed a field that was placed a few lines below I didn't see....

    I was missing the comma, it works now

    Thanks

    Joe

    WHEN 07 THEN (APPT_RPT_APPOINTMENT.DURATION / 60) END AS Julyschedhours <-- no comma

    APPT_RPT_APPOINTMENT.START_DATETIME

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

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