I am working on SQL Server 2008. I have created a trigger on a table which will send a notification mail if the records are updated. I have included what is getting updated in body of the mail. Along with that I also want to include who has updated the records. Some information like login name. Is it possible? And if yes, how can I do that? Please help.
How to include login information in an sql server mail?
105 Views Asked by user2277333 At
2
There are 2 best solutions below
Related Questions in SQL
- Can MVC.NET prevent SQL-injection at razor or controller level?
- SQL server not returning all rows
- When dealing with databases, does adding a different table when we can use a simple hash a good thing?
- Creating a parametrized field name for a SELECT clause
- Combine two rows based on common ID
- Column displays each count
- Slick query for one to optional one (zero or one) relationship
- Aggregate and count in PostgreSQL
- MAX and GROUP BY - SQL
- SQL statement for a tricky 2 table query
- How to create nested selects with sql?
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Best Practice for adding columns to a Table in Oracle database
- SQL FIFO STACK using two tables
- SQL Query - Order by String (which contains number and chars)
Related Questions in SQL-SERVER-2008
- How to create separate rows for each unique value in source data
- How to Multiply all values within a column with SQL like SUM()
- Concatenated string in column alias
- Column value divided by row count in SQL Server
- MSSQL Bulk Insert CSV - Multiple columns include commas
- String to DATETIME with TimeZone
- Compare each records of same table in sql server and return duplicates
- 2008R2 SQL Code for case when using the SUM?
- Separate string into columns
- Pass parameters to sql agent job step (Transact-SQL Script)
- using Case get values from different table in sql server
- How to use Replace an unknown length of characters in SQL Server?
- Join Multiple table without using joins
- call an sql function by name returned by select
- How to create a check (Table A.Id and Table B.Id and TypeId = 1)?
Related Questions in SP-SEND-DBMAIL
- SQL Job (Send Mail) - error formatting query probably invalid parameters
- Stored procedure using SEND_SP_DBMAIL sends incorrect/duplicate emails- to recipient that has been removed from list and others
- using msdb.dbo.sp_send_dbmail with @query parameter error in trigger
- SQL sp_send_dbmail adding T in date column
- meaning of the values of sent_status on msdb.dbo.sysmail_mailitems
- Testing sp_send_dbmail
- SQL 2008 R2: DBMail status 'sent', mail sometimes not received depending on the value of the subject
- Working with sub-folders in file path with sp_send_dbmail and T-SQL
- sp_send_dbmail Error Formatting Query
- Send multiple emails at the same time with different payload sizes - Email received in wrong order using sp_send_dbmail
- Testing the result set of an sp_send_dbmail query?
- sql server 2008 dbmail error sp_send_dbmail - cannot insert null value into 'last_mod_user' in table sysmail_mailitems
- Only some e-mail gets sent successfully from sp_send_dbmail (Database Mail) on SQL Server 2005
- msdb.dbo.sp_send_dbmail Invalid Recipients get stripped out automatically
- How to include login information in an sql server mail?
Related Questions in DBMAIL
- SQL Job (Send Mail) - error formatting query probably invalid parameters
- need to recreate sp_send_dbmail in msdb system procedure folder
- sql server 2008 dbmail error sp_send_dbmail - cannot insert null value into 'last_mod_user' in table sysmail_mailitems
- How to include login information in an sql server mail?
- archiveopteryx VS dbmail
- DB Mail could not sent mail to the recipients because of the mail server failure in sql server 2012
- adding dynamic content within body of an email (database mail) with sp_send_dbmail
- Send email from SQL server for each row of a dataset
- send mail SQL Server with Dynamic smtp
- Failed to execute msdb.dbo.sp_send_dbmail
- How to send an email on finding bad data in a table in sql server
- Why doesn't a SQL trigger have permissions to use e-mail?
- SSMS Database Mail not sending to multiple recipients anymore
- RC ignored - Failed to initialize sqlcmd library with error number -2147467259
- A call to SSPI failed, see inner exception. DB Mail can't send email
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Are you familiar with the USER_NAME and SUSER_SNAME functions? Not sure how your trigger is configured, but in my triggers I use them to add entries to an audit table indicating who updated or inserted rows. So you should be able to add them to whatever SELECT statement is feeding your email.