«

sql语句执行超时

时间:2023-3-19 16:19     作者:!admin     分类:


update语句是很耗时的,你可以这样.

1.将有用的数据先存入到一个临时表.
select shop_snsn.*(这里把shop_snsn.kucun,替换成bt.kucun) into #shop_snsn_temp from shop_snsn, bt where bt.isbn = shop_snsn.cjname and shop_snsn.shopclass=2

  1. 删除shop_snsn表中的数据
    delete from shop_snsn
    where exists (select 'x' from bt where bt.isbn = shop_snsn.cjname) and shop_snsn.shopclass=2

  2. 将#shop_snsn_temp表中的数据插回到shop_snsn表中.
    insert into shop_snsn select * from #shop_snsn_temp

  3. 删除临时表drop table #shop_snsn_temp