SQL Server 2000 will no longer be supported

You can refer to section “SQL Server 2000 Support Information” in link –  http://www.microsoft.com/en-us/sqlserver/support/support-updates.aspx . If you are using SQL 2000, please consider upgrading to latest version of SQL Server as soon as possible.   Upgrade to SQL 2008 R2 – http://msdn.microsoft.com/en-us/library/bb677622(v=SQL.105).aspx Upgrade to SQL Server 2012 – http://technet.microsoft.com/en-us/library/bb677622.aspx


Email Query output as ANSI / UNICODE file attachment using Powershell and Database Mail

#launch sqlps.exe to run the followign script #update servername,email profile, recipient list that matches your environment   $instanceName = “MACHINE\SQLINSTANCE” $targetFileAnsi = “c:\temp\result_ansi.csv” $targetFileUnicode = “c:\temp\result_unicode.csv” $dbQuery = “select SERVERPROPERTY(‘ServerName’) As ServerName, Name, crdate from sysdatabases”   Write-host “Running SQL Query to export to ANSI CSV file” Invoke-Sqlcmd -Query $dbQuery -ServerInstance $instanceName | export-csv $targetFileAnsi…


SQL Database Mail - Security Feature of DatabaseMailUserRole

To prevent anyone from sending arbitrary emails,  Database Mail is guarded by the database role DatabaseMailUserRole.  Users who are not the member of DatabaseMailUserRole cannot send emails except sysadmin who has all privileges.  For example, an unauthorized user sends email by running sp_send_dbmail.  EXEC sp_send_dbmail @profile_name=’MailProfile1′, @recipients=’someone@microsoft.com’, @body=’test message’, @subject=’Ignore this message’ The user will…


SQL Database Mail -- Send Emails in HTML Format

Usually the content of emails is sent by Database Mail in a plain text.  You can change it to HTML format for a richer content.  This article demonstrates how to do it. The article here is assumed that a SQL Database Mail profile “MailProfile1′ has been created.  The MailProfile1 tells Database Mail what account it should…


Enabling email notifications in the SQL Agent for Alerting & Job monitoring

 To enable email notifications in SQL Agent you will need to follow the following steps: 1. Configure Datbase Mail: create an email SMTP account and corresponding Email Profile. To do so please follow directions outlined in the blog post: “SQL Database Mail – Send Emails from SQL Server”. 2. In SSMS (SQL Server Managment Studio)…

0

Database Mail–when attachments don’t work

In a previous post (SQL Database Mail – Send Emails with Attachment), we described how to attach a file to an email. There is a known bug related to this. Under certain conditions, the mail attachment will not be sent. If a mail with an attachment is sent from within a transaction in snapshot isolation…

0

SQL Database Mail - Send Emails with Attachment

Database Mail allows you to attach files in emails.   Several examples are provided to show how you can do it. The article here is assumed that a SQL Database Mail profile “MailProfile1′ has been created.  The MailProfile1 tells Database Mail what account it should use to send emails.  For how to create a Database Mail profile, you can refer…


Database Mail – Validating your SMTP mail server configuration using powershell

  Database mail relies on .NET framework’s SMTP client API to send emails. You could write a simple power shell script like this to test out if you are able to send mails using your smtp server Sample Powershell Code to send email: 1: $smtpServer = “emailserver” 2: $smtpPort = 25 3: $emailFrom = “from@domain.com”…


SQL Database Mail - Send T-SQL Results by Email

This post demonstrates how you can have T-SQL results being sent to you in emails by using SQL Database Mail. The article here is assumed that a SQL Database Mail profile “MailProfile1′ has been created.  The MailProfile1 tells Database Mail what account it should use to send emails.  For how to create a Database Mail profile, you can refer to the previous…


SQL Database Mail - Send Emails from SQL Server

Email is so popular now.   Do you also want to send emails from database applications by using T-SQL statements?  Do you want to send a result of T-SQL queries directly to some one else?  If you do, Database Mail is the solution to fulfill your needs.  This post is a brief introduction that demonstrates how…