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
when i running this query using asp the following error occured. How to solve this issue?
当我使用asp运行此查询时发生以下错误。如何解决这个问题?
Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
Microsoft OLE DB Provider for ODBC Drivers错误'80040e31'
[Microsoft][ODBC SQL Server Driver]Timeout expired
[Microsoft] [ODBC SQL Server驱动程序]超时已过期
1 个解决方案
#1
1
Instead of using a not in
, use a left join
:
不使用not in,而是使用左连接:
delete from tablename
left join tablename2 on tablename2.fieldid = tablename.fieldid
where tablename2.fieldid is null
#1
1
Instead of using a not in
, use a left join
:
不使用not in,而是使用左连接:
delete from tablename
left join tablename2 on tablename2.fieldid = tablename.fieldid
where tablename2.fieldid is null