简体   繁体   English

如何解决操作数类型冲突:date is incompatible with int

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

as mentioned in title I'm trying to insert a data to a table from another table below here.如标题中所述,我正在尝试将数据从下面的另一个表插入到表中。

Insert into dbo.result (
resultdate,
examdate
)
Select 
ResultDate,
ExamDate
From dbo.examdata

But I'm getting the error like in the title.the data type of columns in result table for both the columns are int but in examdata both columns are date data types and I don't want to change the data type of result table.但是我得到了标题中的错误。两列的result表中列的数据类型都是int但在examdata中两列都是date数据类型,我不想更改结果表的数据类型。 How to resolve this issue?如何解决这个问题?

Insert into dbo.result (
resultdate,
examdate
)
Select 
CONVERT(INT,FORMAT(ResultDate,'yyyyMMdd')) as ResultDate,
CONVERT(INT,FORMAT(ExamDate,'yyyyMMdd')) as ExamDate
From dbo.examdata

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

相关问题 操作数类型冲突:日期与int不兼容? - Operand type clash: date is incompatible with int? 如何修复错误 - 操作数类型冲突:日期与 int 不兼容 - How to fix the error - Operand type clash: date is incompatible with int 操作数类型clash int与sql server中的日期不兼容 - operand type clash int is incompatible with date in sql server SQL Server 2012(触发器)操作数类型冲突:int与日期不兼容 - SQL Server 2012 (triggers) Operand type clash: int is incompatible with date 存储过程操作数类型冲突:日期与int不兼容 - Stored Procedure Operand type clash: date is incompatible with int 操作数类型冲突:日期与用CONVERT()解决的int不兼容...为什么? - Operand type clash: date is incompatible with int solved with CONVERT() … but WHY? SQL错误IS操作数类型冲突:int与日期不兼容 - SQL ERROR IS Operand type clash: int is incompatible with date SQL Server Operand类型冲突:日期与int不兼容 - Sql Server Operand type clash: date is incompatible with int SQL语句不起作用 - “操作数类型冲突:日期与int不兼容” - SQL statement not working - "Operand type clash: date is incompatible with int' 操作数类型冲突:int 与日期、UNION ALL、NULL 值不兼容 - Operand type clash: int is incompatible with date, UNION ALL, NULL value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM