mtoynbee Posted May 5, 2009 Share Posted May 5, 2009 I have a delete trigger but I want to email me the username field value that has been deleted. Is this possible - if so how? Sample code: CREATE TRIGGER delUsers ON db_users AFTER DELETE AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; EXECUTE MSDB.dbo.sp_send_dbmail @profile_name = 'Mail Profile 1' , @recipients = 'me@email.co.uk' , @copy_recipients = '' , @blind_copy_recipients = '' , @SUBJECT = 'User Deleted' , @body = 'User Deleted' , @body_format = 'HTML' , @importance = 'Normal' , @sensitivity = 'Normal' END GO Quote Link to comment https://forums.phpfreaks.com/topic/156929-delete-trigger-sql-server-2005/ Share on other sites More sharing options...
Gamic Posted June 14, 2009 Share Posted June 14, 2009 In the trigger you would want something like this: declare @deletedUserName as <someType> select @deletedUserName = userNameField from deleted Quote Link to comment https://forums.phpfreaks.com/topic/156929-delete-trigger-sql-server-2005/#findComment-855793 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.