简体   繁体   English

操作数类型冲突:int与日期不兼容

[英]Operand type clash: int is incompatible with date

I am inserting values in my table and I'am stuck in a Date datatype problem 我在我的表中插入值,我陷入了Date数据类型问题

Insert into EMP_1 
(
    EMP_NUM, 
    EMP_LNAME,
    EMP_FNAME,
    EMP_INITIAL, 
    EMP_HIREDATE, 
    JOB_CODE
)
Values 
(
    101, 
    'News', 
    'John', 
    'G', 
    08-11-00, 
    502
);

this is the execution result 这是执行结果

Operand type clash: int is incompatible with date 操作数类型冲突:int与日期不兼容

Wrap the date in ' or it will treat it as a integer value and its expecting a date. 将日期换行'或者将其视为integer数值并期望日期。

Insert into  EMP_1 (EMP_NUM, EMP_LNAME,EMP_FNAME,EMP_INITIAL, EMP_HIREDATE, JOB_CODE)
Values (101, 'News', 'John', 'G', '08-11-00', 502);

Always make use of quotes 始终使用引号

Insert into EMP_1 (EMP_NUM,EMP_LNAME,EMP_FNAME,EMP_INITIAL,EMP_HIREDATE,JOB_CODE) Values ('101','News','John','G','08-11-00','502'); 插入EMP_1(EMP_NUM,EMP_LNAME,EMP_FNAME,EMP_INITIAL,EMP_HIREDATE,JOB_CODE)值('101','新闻','John','G','08-11-00','502');

or you can write NOW() or CURDATE()function 或者您可以编写NOW()或CURDATE()函数

Insert into EMP_1 (EMP_NUM,EMP_LNAME,EMP_FNAME,EMP_INITIAL,EMP_HIREDATE,JOB_CODE) Values ('101','News','John','G',NOW(),'502'); 插入EMP_1(EMP_NUM,EMP_LNAME,EMP_FNAME,EMP_INITIAL,EMP_HIREDATE,JOB_CODE)值('101','新闻','约翰','G',现在(),'502');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM