Toplu_2.45_EINVCUSTOM(EfaturaGümlük) İşaretle_Cursor
DECLARE @Firmnr NVARCHAR(50), @Qry NVARCHAR(max); declare cur cursor KEYSET for select CASE WHEN LEN(CAST(NR AS NVARCHAR(50)))=1 THEN '00'+CAST(NR AS NVARCHAR(50)) WHEN LEN(CAST(NR AS NVARCHAR(50)))=2 THEN '0'+CAST(NR AS NVARCHAR(50)) ELSE CAST(NR AS NVARCHAR(50)) END from L_CAPIFIRM OPEN cur fetch first FROM cur INTO @Firmnr while @@FETCH_STATUS=0 BEGIN SELECT @Qry = ' UPDATE LG_' + @firmNr + '_CLCARD SET ISPERCURR=0 WHERE ISPERCURR IS NULL'; EXEC sp_executeSQL @Qry fetch next from cur INTO @Firmnr end close cur deallocate cur