日期:2014-05-17  浏览次数:20903 次

更新数据库信息的问题
我有大概30万条的数据要更新
用什么方法好呢

我现在的方法是
for   id=1   to   20000
set   rs=toconn.execute( "select   content   from   "&mdbtable& "   where   Info_ID= "&id)
if   not   rs.eof   then
sStr=rs(0)
rStr=sStr
rStr=check(rStr)
if   rStr <> sStr   then
toconn.execute( "update   "&mdbtable& "   set   content= ' "&rStr& " '   where   Info_ID= "&id)
response.Write(id& " <br> ")
response.Flush()
end   if
end   if
next

但效率还是比较慢
5分钟才1000条
谁有更好的办法啊

------解决方案--------------------
一句sql就可以了, 如果还慢,看下索引的位置对不对
update table set content= 'xxx ' where Info_ID > = 1 And Info_ID <=2000 And content <> "xxxxxx "
------解决方案--------------------
5分钟1000条是很慢
update [dbo].[table1] as t1 set item1=t2.itemA from [dbo].[table2] as t2 where t1.someItem=t2.specifiedItem

好像有条类似的语句可以,好久没有用了,忘却了。