Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server sql server作业生成错误_Sql Server_Sql Agent Job - Fatal编程技术网

Sql server sql server作业生成错误

Sql server sql server作业生成错误,sql-server,sql-agent-job,Sql Server,Sql Agent Job,我在执行作业时出现以下错误: The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. 这是在作业的存储过程中执行的我的查询存储过程: Update table1 Set Field1 = DurationComputeFunction(Customer_ID,Start_Date) , Event_DateStam

我在执行作业时出现以下错误:

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
这是在作业的存储过程中执行的我的查询存储过程:

Update   table1
    Set     Field1 = DurationComputeFunction(Customer_ID,Start_Date)
            , Event_DateStamp = GetDate()
    From    table1 
    WHERE   DateDiff(day,Start_Date,getdate()) < 90
使用windows身份验证也返回相同的错误,但在sql server身份验证中执行时不返回错误(2014-10-23 00:00:00.000)

因此,我推断作业可能是通过windows身份验证执行的,这就是存储过程(查询)生成错误的原因

我说的对吗

如果是,是否有任何方法强制使用sql server身份验证执行作业


谢谢在这些情况下,建议使用设置日期格式。你可以像下面这样做

set dateformat dmy
select cast('23/10/2014' as datetime)
尝试检查这个,我相信它会工作。存储过程也存在同样的错误,必须在Update语句之前包含SETDATEFORMAT DMY

set dateformat dmy
select cast('23/10/2014' as datetime)