Avatar of mrrmpc

asked on 

Conversion failed when converting date and/or time from character string.

Hi All

I have an HL7 message coming in and am attempting to write it an MS SQL db.
The MS SQL db has the MSHMsgDtm defined as MSHMsgDtm(datetime,null)

The error I get back on the is the following: "Conversion failed when converting date and/or time from character string."

If I hard code a value in on the date such as '1998-12-25', it posts.  I did this simply to make sure the rest of my statement was working.

I attempted CONVERT(DATETIME,@MSH.DateTimeOfMessage.Time,101) as well as many other variations. I'm not an SQL guru and am spending a great deal of time trying to figure out the correct syntax. Thanks for any assistance.

INSERT INTO HOSPITAL_Cutover_DFTs (MSHSendApp, MSHSendFac, MSHRecvApp, MSHRecvFac, MSHMsgDtm, MSHCtrlID, PIDIntID, PIDLastName, PIDFirstName, PIDVisitNo, FT1SetID, FT1TransID, FT1TransBatchID, FT1TransPostDtm, FT1TransType, FT1TransCode, FT1TransDesc, FT1TransDescAlt, FT1TransQty, FT1TransAmtExt, FT1TransAmtUnit, FT1DeptCode, FT1PatnLocn, FT1PatnType, FT1DiagCode, FT1PerfByCode, FT1ProcCode)
Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon