create OR ALTER proc StokNo_Update
as
UPDATE n  SET StokNo = k2.SIRA  FROM STOKKARTI  n , (select Kodu,StokNo,NoId,RANK () OVER (order  BY   Kodu DESC) SIRA FROM STOKKARTI) k2 where n.Kodu=k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM STOKHAR  n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM SIPARISHAR   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM StokBarkodlari   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM StokFiyat   n ,  STOKKARTI k2 where n.Kodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM StokDB   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM StokHarLog   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM MuadilStoklar   n ,  STOKKARTI k2 where n.MuadilStokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM Buton   n ,  STOKKARTI k2 where n.ButonDegeri =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM PDegFiyatlar   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM SipHar   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM TEKLIFHAR   n ,  STOKKARTI k2 where n.StokKodu =k2.Kodu 
UPDATE n  SET StokNo = k2.StokNo  FROM Tevkifat   n ,  STOKKARTI k2 where n.Kod =k2.Kodu 
--- FaturaFiyatGuncellemeFarki -StokHarLog -Tedarikciler TABLOLARI KONTROL ET



 