Bir imleç ile güncelleştirmek Employeekopie1
adlı belirli bir tabloda bir sütunu güncelleştirmek istiyorum.SQL Server 2008 R2
Güncelleme için çalışıyorum sütundur FK_Profiel
ben sütunda FK_Profiel
koymak için çalışıyorum değerler bir imleç alıyorum değerlerdir (değerler tip int
vardır). İmleç, doğru değerleri elde etmek için birleştirmeler kullanarak farklı bir tablodaki bir sütundan değerler alıyor.
Kullanılan sorgu sorgusunun sonucu, farklı değerler içeren birden çok satır döndürür.
Seçim sorgusunun ilk sonucu, doğru olan 114'dür. Sorun, bu değerin, niyetim olan FK_Profiel
sütunundaki tüm alanlara atanmasıdır.
Seçme sorgusundaki tüm değerleri atamak istiyorum.
DECLARE @l_profiel int;
DECLARE c1 CURSOR
FOR select p.ProfielID
from DIM_Profiel p,DIM_EmployeeKopie1 e1,employee e
where e1.EmpidOrigineel = e.emplid and e.profile_code = p.Prof_Code
for update of e1.FK_Profiel;
open c1;
FETCH NEXT FROM c1 into @l_profiel
WHILE @@FETCH_STATUS = 0
BEGIN
SET NOCOUNT ON;
UPDATE DIM_EmployeeKopie1
set FK_Profiel = @l_profiel
where current of c1
end
close c1;
deallocate c1;
yardım edin, thx şu şekildedir:
kodudur.
Eh, buna beni yendi. +1. – Lamak
Cevaplar için teşekkürler. Bu benim problemimi çözdü. – user717316
zarafet hareket halinde, +1 – Paceman