I'm trying to update the SQL rows where the update query is located in the while loop.
DECLARE @Sayac INT
SET @Sayac= (select count(ABBREVIATION) from [MSTR_MD].[dbo].[v_OpcoGeneral_UserList])
WHILE (@Sayac>0)
BEGIN
PRINT @Sayac;
(select ABBREVIATION FROM [MSTR_MD].[dbo].[v_OpcoGeneral_UserList] WHERE [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ID = @Sayac)
UPDATE [dwh].[dbo].[opco_securty]
SET opco_general = REPLACE(opco_general, (select ABBREVIATION FROM [MSTR_MD].[dbo].[v_OpcoGeneral_UserList] WHERE [MSTR_MD].[dbo].[v_OpcoGeneral_UserList].ID = @Sayac), '')
SET @Sayac = @Sayac - 1
END
But in this query, it doesn't work as expected. I guess the while loop is not being compiled like in programming languages. Could you please recommend a solution? Thanks!
Basically for instance, if "Ugurcan.Kaya" is received from the view, remove "Ugurcan.Kaya" from the opco_general (text) column on the opco_securty table.
