2010-03-31 139 views
1
set con2=server.CreateObject("ADODB.Connection") 
con2.ConnectionTimeout =1200 
con2.open "Driver={SQL Server};server=111.111.111.11;user id=xx;pwd=xxx;Database=xxx" 
con2.execute("DELETE FROM tablename WHERE fieldid NOT IN(SELECT fieldid FROM tablename2)") 
con2.close 
set con2=nothing 

当我运行此查询使用ASP发生以下错误。如何解决这个问题?SQL服务器问题超时过期

Microsoft OLE DB提供程序的ODBC 驱动程序错误 '80040E31'

[微软] [ODBC SQL服务器 驱动程序]超时过期

+0

在SQL Server Management Studi中只运行SQL语句需要多长时间Ø – 2010-03-31 07:01:36

+0

1分24秒 – Avinash 2010-03-31 07:43:55

回答

1

而不是使用一个not in的,使用left join

delete from tablename 
left join tablename2 on tablename2.fieldid = tablename.fieldid 
where tablename2.fieldid is null