How to update more than one row in the trigger?

Is the trigger:
ALTER TRIGGER [dbo].[WorkTimeUPD_Warning] ON [dbo].[Workers]
INSTEAD OF UPDATE
AS
IF(CURRENT_TIMESTAMP BETWEEN TRY_PARSE('09:00:00' AS DATETIME) AND TRY_PARSE('21:00:00' AS DATETIME))
BEGIN
 UPDATE dbo.Workers SET [WORKERS_ID] = (SELECT WORKERS_ID FROM inserted),
 [NAME] = (SELECT NAME FROM inserted),
 [ADDRESS] = (SELECT ADDRESS FROM inserted),
 [DEPT_ID] = (SELECT DEPT_ID FROM inserted),
 [INFORMATION] = (SELECT INFORMATION FROM inserted)
 WHERE [WORKERS_ID] = (SELECT WORKERS_ID FROM deleted);
 print('Data updated!');
END
ELSE
BEGIN
 print('Updating data in non-working time, - NOT AVAILABLE!');
 INSERT INTO dbo.WorkersUPDLogs(WorkerId,ModifyDate)
 VALUES ((SELECT WORKERS_ID FROM inserted), GETDATE())
 END


When you update one row, the trigger is held. Example query: UPDATE Workers SET [NAME] = 'lala' WHERE [WORKERS_ID] = 22 (works)
And if you're updating multiple rows there is a bug. Example query: UPDATE Workers SET [NAME] = 'lala' (not working, gives error)

How to fix, please help! PS do not judge strictly, still quite "green" in this direction, thanks :)
March 12th 20 at 08:03
1 answer
March 12th 20 at 08:05
To use linking:
CREATE TRIGGER PersonFormatUpdate ON [PersonFormat] FOR UPDATE AS 
BEGIN
 SET NOCOUNT ON 
 UPDATE FilmAttributeValue
 SET [Value] = inserted.[Format]
 FROM FilmAttributeValue 
 INNER JOIN inserted ON FilmAttributeValue.[ValueFormat] = inserted.ID
END

The IN operator
CREATE TRIGGER PersonDelete ON [Person] FOR DELETE AS 
BEGIN
 SET NOCOUNT ON 
 DELETE FROM Internet WHERE (Internet.Kind = 'P') 
 AND (Internet.[Object] IN ( SELECT ID FROM deleted))
END
GO

The cursor
CREATE TRIGGER AlbumRoleInsert ON AlbumRole INSTEAD OF INSERT AS 
BEGIN
 SET NOCOUNT ON
 DECLARE @order INT, @PRF INT, @ROL VARCHAR(500), @mas INT, @pla BIT, @mem BIT, @gue BIT
 DECLARE @ID INT, @RLR VARCHAR(500)
 DECLARE @Role TABLE(Role VARCHAR(100))

 LISTROLE DECLARE CURSOR LOCAL FAST_FORWARD FOR
 SELECT Album, Master, Performer, Play, Member, Role, SpecialGuest
 FROM Inserted
 OPEN LISTROLE
 FETCH LISTROLE INTO @ALB, @mas, @PRF, @pla, @mem, @ROL, @gue
 WHILE @@FETCH_STATUS = 0 BEGIN
 -- The entry there?
 IF EXISTS( SELECT * FROM AlbumRole WHERE (Album = @ALB) AND (Performer = @PRF)) BEGIN
 SELECT @ID = ID, @RLR = [Role] FROM AlbumRole WHERE (Album = @ALB) AND (Performer = @PRF)
 INSERT INTO @Role SELECT TRIM( value ) FROM STRING_SPLIT( @RLR, ',' )
 INSERT INTO @Role SELECT TRIM( value ) FROM STRING_SPLIT( @ROL, ',' ) 
 WHERE TRIM( value ) NOT IN ( SELECT [Role] FROM @Role )
 DELETE @Role WHERE (TRIM( [Role] ) = ")
 SELECT @RLR = STRING_AGG ( [Role], ', ' ) FROM @Role
 -- Updating the list.
 UPDATE AlbumRole SET Role = @RLR WHERE ID = @ID
 END ELSE BEGIN
 -- Add: 
 INSERT INTO AlbumRole ( Album, Master, Performer, Play, Member, Role, SpecialGuest ) 
 VALUES( @ALB, @mas, @PRF, @pla, @mem, @ROL, @gue )
END
 -- The following field
 FETCH LISTROLE INTO @ALB, @mas, @PRF, @pla, @mem, @ROL, @gue
END
 CLOSE LISTROLE
 DEALLOCATE LISTROLE
END
GO

Find more questions by tags SQL Server