不允许从数据类型 datetime 到 int 的隐式转换错误.使用 CONVERT 函数运行此查询 [英] Error of Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query

查看:148
本文介绍了不允许从数据类型 datetime 到 int 的隐式转换错误.使用 CONVERT 函数运行此查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 DOCDate 字段的库存表,它的数据类型为日期时间,当我运行查询时,它显示错误

I have table of stock with DOCDate field and it has datatype as datetime, when i am running my query, it shows me error

'不允许从数据类型 datetime 到 int 的隐式转换.使用 CONVERT 函数运行此查询.'

'Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.'

我的查询是

insert into SSPERPStock (LinkID, DocNo, DocDate, VoucherType, ProductID, Weight, AL, InEdit, CreatedU‌​serId) 
values (IDENT_CURRENT('SSPERPDailyInkConsumptionTransaction'),'DOC1001','2013-02-‌​14','ICPacked',8,5,'L',0,GETDATE())

这个谜团的解决办法是什么??

What can be the solution of this mistry??

推荐答案

您正在尝试将日期 (GETDATE()) 添加到您的列 CreatedU‌ serId

You are trying to add a date (GETDATE()) to your column CreatedU‌​serId

insert into SSPERPStock (... , CreatedU‌​serId) 
values (... , GETDATE())

这可能是一个 int 而不是你想要做的.

which is probably an int and not what you wanted to do in the first place.

这篇关于不允许从数据类型 datetime 到 int 的隐式转换错误.使用 CONVERT 函数运行此查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆