往数据里添加记录时需要检索一下该记录是否已经存在。如果存在就不添加。
我用的方法是用select 如果不存在就 insert into(在asp中),结果问题就来了执行速度很慢。数据库里现在一共才3万多条记录。照我的方法插几十条记录就需要好几秒。有没有什么方法可以执行快一些?

解决方案 »

  1.   

    你的方法是 
    insert into 表
    select * from 表2 where(条件)
    ????????执行速度这么慢啊???
      

  2.   

    set rs=conn.execute(select id from 表 where xxxxx=xxx)
    if rs.eof then
        insert into 表 ..........
    end if速度超慢。
      

  3.   

    呵,想到一个变通的办法了。
    执行一次select ,把结果保存在内存中 以后就查数据库了 直接在内存中比较,嘿嘿
      

  4.   

    打错了  保存到内存以后 以后就不需要select了