locked
Update the due date field in task RRS feed

  • Question



  • Hello All

    I want to update the due date field in task but in my database i have the date and the
    time in two columns separate I want to merge the “ENDDATE” and “Due date” Fields into the new DateTime field “DueDate  with this sql statement :

    Update  Mydatabase..Mytable

    set Duedate = CONVERT(NVARCHAR(19), CONVERT(VARCHAR(12), CAST(ENDDATE as DATE))

    +  ' ' + CONVERT(VARCHAR(12), CAST(due as Time)), 101)

    where Due is not null

    but I am
    getting this error message

    Msg 241, Level 16, State 1,
    Line 1
    Conversion
    failed when converting date and/or time from character string.

    Can anybody
    help me out Please

    Thanks,

    Monday, February 27, 2012 7:50 PM

All replies

  • Hi,

    try changing your SQL script as follows

    Update  Mydatabase..Mytable
    
    set Duedate = CONVERT(Datetime, CONVERT(VARCHAR(12), CAST(ENDDATE as DATE))
    +  ' ' + CONVERT(VARCHAR(12), CAST(due as Time)), 101)
    where Due is not null


    Regards,
    Damian Sinay

    Monday, February 27, 2012 8:39 PM
  • tahnks Dsinay

    I am getting the same error message any idea?

    Monday, February 27, 2012 8:52 PM