DELETE FROM dbo.iniGoodsStocks WHERE krec IN (SELECT rec FROM  stock WHERE UserCode='仓库编号')--清除指定仓库期初库存


DELETE FROM dbo.iniGoodsStocks WHERE krec IN (SELECT rec FROM  stock WHERE UserCode='仓库编号') AND prec IN (SELECT rec FROM ptype WHERE UserCode='商品编号')--清除指定仓库指定商品期初库存



--注意，执行脚本前数据备份