Is it possible to attach the result produced by query in .txt format while sending mail in sql ?
Can we attach the result produced by query in .txt format in sql?
235 Views Asked by viji At
1
There are 1 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 DATABASE-MAIL
- SQL Database Mail Failure Results in Duplicate Emails
- Can we attach the result produced by query in .txt format in sql?
- what's the server role for database mail on sql server 2008?
- Only some e-mail gets sent successfully from sp_send_dbmail (Database Mail) on SQL Server 2005
- How can we encode the image into the body of the email when sending mail using database mail in sql 2008?
- Database Mail - File Attachment Access Denied
- Databasemail working for live environment but not test environment on the same SQL Server instance
- SQL Execute per each result row
- Sql Server Database Mail attachments from FileTable msg 22015 (file is invalid)
- Is it a good idea to use Database Mail as an email relay server?
- How to use SQL Server Transaction inside T-SQL TRY...CATCH block
- Truncate Database Mail table
- Database Mail registry settings won't stay configured
- How can I find the source of a specific, SQL Server Database Mail-generated message?
- After renaming SQL Server 2016 cluster there's still a trace of old name from Database Mail
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?
One way is to use the extended stored procedure xp_sendmail. It does require that you have a MAPI profile and SQL Mail configured. Then it can be used like this:
xp_sendmail @recipients = '[email protected]', @subject = 'Query Results', @query = 'SELECT fname, lname FROM Employees WHERE empid = 9'
In the above example the results of the query will be included in the e-mail message. Read in SQL Server Books OnLine more about the additional parameters for xp_sendmail. They control how the query is executed (database context, database user) and how it is displayed (headers, formatting, attach query results in a file).
Here is more info on configuring SQL Mail: http://support.microsoft.com/kb/q263556/