Below we have an trigger command which executes the file in location given ,
Find the schema and more about trigger in :
Write a Simple Trigger
Now we are adding trigger to table events ,
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
EXEC sp_configure 'show advanced options', 1
-- To update the currently configured value for advanced options.
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
-- To update the currently configured value for this feature.
create TRIGGER [dbo].[trgAfterInsert1]
AS declare @id int,@tag int,@audio int;
EXEC master ..xp_cmdshell '\\filelocation\a.mp3'
- Make sure the folder is shared where the file to be executed is available
- also allow the sql user to access the file and have privilege , you can set from server -> user -> securables
- Also set user as sysadmin to perform actions like executing exe files or playing mp3 files