[英]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.