Good day, I write a simple trigger in MS SQL and gives an error in the WHERE block object_name = @name_device. he cannot compare a string without quotes.
CREATE TRIGGER tcontrolpuskdev ON [dbo].[tcontrol] AFTER INSERT AS DECLARE @pusk1 int(1), @name_device varchar(6); SET @pusk1 = (SELECT TOP(1) Puskatel1 from instered) SET @name_device = (SELECT TOP(1)Puscatel1 FROM INSERTED) UPDATE devices SET pusk1_dev = @pusk1 WHERE object_name = @name_device GO Here is the error text itself:
Msg 2716, Level 16, State 1, Procedure tcontrolpuskdev, Line 11 [Batch Start Line 0] Column, parameter, or variable # 1: Cannot specify an int.
Please advise how to solve this problem.