获取错误超时已过期。操作完成之前经过的超时时间或服务器没有响应 [英] Getting error Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
问题描述
我有一个sql查询,在我的本地个人电脑上执行25秒,
但是当我单击一个按钮来调用该sql查询过程,它会抛出错误,因为
超时已到期。操作完成之前已经过了超时时间或者服务器没有响应
我尝试了很多东西,我增加了命令时间,我也有将其值设置为零但仍然没有成功。
我也在sql server中检查超时属性,即使它已被设置为零。
Hi,
I have a sql query which is getting executed in 25 sec in my local personal pc,
but when i click a button to call that sql query procedure,it is throwing error as
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding
I tryied many thing like ,i increased the commandtimeout,also i had set its value to zero but still no success.
also i have check timeout property in sql server ,even there it has been set to zero.
insert into T_Exception(inv_id,StatusID,[Status],PVID,Comitted,Remark,EStatusDate,
UserName,Deptid,BldgID,Duplicate,Locationid,ExceptionFlag)
select i.inv_id,@statusid ,'Status: Pending',@PVID,0,'',GETDATE(),@loginUserid
,i.DeptID,l.BldgID,0,i.LocationID,0
from inventory i inner join dbo.StatusMaster s on i.StatusID=cast (s.StatusID as bigint)
inner join locationmaster l on l.locationid=i.LocationID
where i.StatusID in (1,14) and i.Inventory_no<>'0' and i.Inventory_no IS NOT NULL
and i.inv_id not in
(
select inv_id from dbo.ScannedLog where pvid=@PVID
)
以上是我的sql查询,它将记录插入到异常表中。
数据库中还有一万条记录。
库存表有一万条记录和
select inv_id来自dbo.ScannedLog,其中pvid = @ PVIDquery返回20条记录。
表示,10000-20 = 9080记录必须插入到异常表中。
above is my sql query which insert record into exception table .
also there are ten thousand record in database.
inventory table has ten thousand records and
select inv_id from dbo.ScannedLog where pvid=@PVIDquery return twenty records.
means , 10000-20=9080 record has to be inserted into the exception table.
推荐答案
有些事情你可以做什么:
1.你可以在第一时间检查表的索引。您可以从此处 [ ^ ]。
2.您可以简化您的where条件,通常查询的执行时间取决于它。 (我的意思是条件的顺序和数量)
There are some things what you can do:
1. You can check the indexes for the tables at the first time. You can read further about this topic from here[^].
2. You can simplify your where condition, usually the execution time of your query depends on it. (I mean the order and the count of the conditions)
这篇关于获取错误超时已过期。操作完成之前经过的超时时间或服务器没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!