I have a trigger that works only for specific input and command from the user, however I want it to work for any user input that is available in the database
--Server part :
alter trigger ProductInsteadOfDelete on Products
instead of delete
as
declare @ProductName nvarchar(max)
update Products
set Discontinued = 1 where ProductName = @ProductName
--Client part :
delete from Products where productName = 'Psi-Blade'
This does not work unless I change set
statement into this :
`set Discontinued = 1 where ProductName = 'Psi-Blade'
and then run the Client part
delete from Products where productName = 'Psi-Blade'
it works only for 'Psi-Blade'
However I want it to work for any @ProductName
input that is available in database(of course).
Doing set Discontinued = 1 where ProductName = @ProductName
is not working.