Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2010
    Posts
    10

    Red face Unanswered: Update Date field error

    Getting an error on my update:I am trying to update a date field where I have created two blank datefield columns. The error I am getting is Conversion failed when converting date and/or time from character string. Can anybody help. Both formats are date time.

    Select
    ,CAST (NULL AS datetime) Medical_Record
    ,CAST (NULL AS datetime) Logbook
    ,CAST(null as varchar(20)) as newint
    INTO Finance.dbo.temp_EDPScanned
    From LMSDATA.dbo.tblOrder O (NOLOCK)
    JOIN LMSDATA.dbo.EnhancedDocumentationPolicyST ED (NOLOCK)
    ON O.OrderID = ed.OrderNumber
    Left JOIN LMSDATA.dbo.tblCIS_Service_Ticket ST (NOLOCK)
    ON ED.ServiceTicketId = ST.ServiceTicketID

    Where CreateDt >= DateAdd(d, -90, GetDate())
    Group BY ST.ServiceTicketID,O.CustomerNumber

    UPDATE E
    SET Medical_Record = 'L.SCANDATE'------ (Field is Datetime Format) ERROR
    From Finance.dbo.temp_EDPScanned E
    LEFT JOIN Acorde.dbo.LMSIDX L
    ON E.CustomerNumber=L.CUSTOMERNUMBER
    Where L.SCANDATE >= E.Createdate
    and L.DOCTYPE = 'Medical Records'

  2. #2
    Join Date
    Apr 2012
    Posts
    213
    Try removing the quotes:

    Code:
    SET Medical_Record = L.SCANDATE
    Hope this helps.

  3. #3
    Join Date
    Dec 2010
    Posts
    10
    Thanks, you're the best, sometimes you need a second eye

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •