我有一个带有 SQL 的 C# 程序,如下所示:
INSERT INTO PDRIVERP
(POLICY
,DRIVERNO
,POINTRECNO
,DRIVERPOINTS
,POINTDESCRIPTION
,DATEOFVIOLATION
,ADDOPERATOR
,DATEADDED
,TIMEADDED
) VALUES (
,0
,1
,37
,2
,'my desc'
,'75000'
,'34'
,{d '2020-07-29'}
,0
)
我有一个如下所示的表定义:
PDRIVERPOINTS FILE,DRIVER('TOPSPEED'),NAME(SourceName),RECLAIM,PRE(IN)
POLDRIVERKEY KEY(+IN:POLICY,+IN:DRIVERNO,+IN:POINTRECNO),OPT,NOCASE
POINTDESCRIPTIONKEY KEY(+IN:POINTDESCRIPTION),DUP,OPT,NOCASE
DRIVERPOINTSKEY KEY(+IN:DRIVERPOINTS),DUP,OPT,NOCASE
ADDEDBYKEY KEY(+IN:ADDOPERATOR,+IN:DATEADDED,+IN:TIMEADDED),DUP,OPT,NOCASE
DATEADDEDKEY KEY(+IN:DATEADDED,+IN:TIMEADDED,+IN:ADDOPERATOR),DUP,OPT,NOCASE
UPDATEDBYKEY KEY(+IN:UPDATEOPERATOR,+IN:DATEUPDATED,+IN:TIMEUPDATED),DUP,OPT,NOCASE
DATEUPDATEDKEY KEY(+IN:DATEUPDATED,+IN:TIMEUPDATED,+IN:UPDATEOPERATOR),DUP,OPT,NOCASE
RECKEY KEY(+IN:RECNO),OPT,NOCASE
REMARKS MEMO(1000)
RECORD RECORD
POLICY DECIMAL(13,0)
DRIVERNO DECIMAL(3,0)
POINTRECNO DECIMAL(3,0)
DRIVERPOINTS DECIMAL(3,0)
POINTDESCRIPTION STRING(80)
DATEOFVIOLATION STRING(8)
ADDOPERATOR STRING(15)
DATEADDED DATE
TIMEADDED TIME
UPDATEOPERATOR STRING(15)
DATEUPDATED DATE
TIMEUPDATED TIME
RECNO DECIMAL(13,0)
我还看到一个看起来像这样的定义:
CLEAR(cDRP:Record)
cDRP:REMARKS = IN:REMARKS
cDRP:POLICY = IN:POLICY
cDRP:DRIVERNO = IN:DRIVERNO
cDRP:POINTRECNO = IN:POINTRECNO
cDRP:DRIVERPOINTS = IN:DRIVERPOINTS
cDRP:POINTDESCRIPTION = IN:POINTDESCRIPTION
cDRP:DATEOFVIOLATION = FORMAT(IN:DATEOFVIOLATION,@D2)
cDRP:ADDOPERATOR = IN:ADDOPERATOR
cDRP:DATEADDED = FORMAT(IN:DATEADDED,@D2)
cDRP:TIMEADDED = FORMAT(IN:TIMEADDED,@T1)
cDRP:UPDATEOPERATOR = IN:UPDATEOPERATOR
cDRP:DATEUPDATED = FORMAT(IN:DATEUPDATED,@D2)
cDRP:TIMEUPDATED = FORMAT(IN:TIMEUPDATED,@T1)
cDRP:RECNO = IN:RECNO
我收到此错误:
ERROR [42000] [SoftVelocity Inc.][TopSpeed ODBC Driver]Expected lexical element not found: <identifier>
读取的一些示例数据如下所示:
请注意表中 DATEOFVIOLATION 和 DATEADDED 之间的不一致。显示不同,所以我试图作为字符串插入,但它只是让我觉得我应该尝试作为日期插入。
我的sql有什么问题?
什么解释了 Softvelocity Database Scanner 中的 DATEOFVIOLATION 和 DATEADDED 显示不同?
如何从 ODBC 中获得更好的错误消息。也许有什么能告诉我哪个字段被破坏或字符串中的多个字符导致语法错误?