[英]Update statement returning 0 rows affected
I am having issues with an update statement where I need to change the employeeid field from 4 to 6 for orders that have an order date of 7-19-1996 我在更新语句时遇到问题,对于订单日期为7-19-1996的订单,我需要将employeeid字段从4更改为6
the statement i made is saying 0 rows affected when i know for a fact there are several rows that fit this description. 当我知道一个事实,即有几行适合此描述时,我所做的陈述是说0行受影响。 Can someone steer me in the right direction as far as why am i getting this result and what I did wrong?
有人可以指导我正确的方向,为什么我为什么会得到这个结果以及我做错了什么? Thanks here is the statement I have so far
谢谢,这是我到目前为止的发言
UPDATE [dbo].[LMOrders]
SET [EmployeeID] = 6
WHERE OrderDate= 7-19-1996
The OrderDate
here is wrong in any database. 这里的
OrderDate
在任何数据库中都是错误的。 If I assume a OrderDate
as a String, you can always do WHERE OrderDate= '7/19/1996'
如果我将
OrderDate
假定为字符串,则始终可以执行WHERE OrderDate= '7/19/1996'
If you need a conversion to date, since with [dbo]. 如果您需要转换日期,请使用[dbo]。 I assume you're with mssql, check https://msdn.microsoft.com/fr-CA/library/ms187928.aspx for conversion.
我假设您使用的是mssql,请检查https://msdn.microsoft.com/fr-CA/library/ms187928.aspx进行转换。
If OrderDate
is DateTime
then you need to format your WHERE
cause correctly: '2007-05-08 12:35:29.123' or if Date
then '2007-05-08' 如果
OrderDate
为DateTime
则需要正确设置WHERE
原因的格式:“ 2007-05-08 12:35:29.123”,或者如果Date
则为“ 2007-05-08”
Here is a great resource, at the bottom of the doc shows the different formats https://msdn.microsoft.com/en-us/library/ms187819.aspx 这是一个很好的资源,文档的底部显示了不同的格式https://msdn.microsoft.com/en-us/library/ms187819.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.