Skip to main content

Posts

Showing posts from June, 2012

Email Alerts are not received...

In one of application, Email alerts are sent using SQL sp_send_dbmail stored procedure. Email alerts were working properly, but suddenly noticed email alerts are not received.

To troubleshoot the issue, first I checked the msdb.dbo.sysmail_event_log table using the below query.

SELECT log_id, event_type, log_date, description, process_id, mailitem_id, account_id, last_mod_date, last_mod_user
FROM
msdb.dbo.sysmail_event_log 
ORDER BY
log_date DESC

If there is any error, you should see records with the event_type value as error.
In my case there are records with event_type value as error, and the description value for those records is same as below

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2018-02-01T10:41:27). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required).  )

As per the error descript…

Use of UrlRoot property in SQL Report Server Config file...

In SQL Report Subscription, you may want to send the report with the link and you can do it by selecting Include Link value. But some times you will get the link include the computer name and not the domain name. Due to that the given is not working if you try to it from outside.


This happens since you have not set the value for the UrlRoot property in the rsreportserver.config file.
To fix it, open the rsreportserver.config file in a text editor and find the UrlRoot property.
Set the value for it as the report server URL with the domain name as below.
https://server.domain.com/Reports
That is it and you will get the link with the given domain name.

Allow E-mail address to be changed for the Users having Browser permission in SSRS Subscriptions...

Normally Users having Browser permission cannot changed the e-mail address (To: field) in the report subscription page. Default the user name is applied as the value for the To: field.
To allow this to be modifiable by users having Browser permission, you need to modify the rsreportserver.config file.

Open the rsreportserver.config in a text editor.
Then set the SendEmailToUserAlias to False and Save the rsreportserver.config file.

That is it.
Now just try to create a New Subscription and you will see there is no value in the To: field and it is editable.

Configuring SSRS Report Subscription using Gmail as the SMTP Server...

Recently I was trying to configure SSRS Report subscription. I checked some links in the MSDN and by following those steps I was unable to configure it. The reason was I used the SMTP server as smtp.gmail.com since we are not having a local smtp server. To use the smtp.gmail.com as the smtp server we need to follow some additional steps other than the steps mentioned here.

The first step is we need to configure a Virtual SMTP server.
First make sure that the SMTP Feature is installed on your server, if not installed it.
Then use IIS Manager to configure the virtual SMTP server. I am using Windows Server 2008 and it has both the IIS 6 and IIS 7.
To configure virtual SMTP server we have to use IIS 6.
Open the IIS 6.0 Manager and you will get a screen as below.


In that if the SMTP Virtual Server is not started, then start it. Then right click on it and select Properties.
You will get a screen as given below.


In the General tab select the IP Address value and unmarked the Limit Number of…

How to get the installed SQL Server details...

We can get the installed SQL Server details such as SQL Server Edition, Product Version and Product Level using the below query. Just open a query window using SQL Server Management Studio and run it.

1:SELECT SERVERPROPERTY ('edition') AS SQLEdition,SERVERPROPERTY ('productversion') AS ProductVersion, SERVERPROPERTY ('productlevel') AS ProductLevel

Passing Parameter value for a rdlc report in ASP.Net and Windows Forms......

In most of the times we need to filter report data. Recently I had a requirement to create a rdlc report and add it to an ASP.Net page. In that I need to filter data using the name.

In ASP.Net and Windows forms, creating data set and reports parts are same. The different is passing the parameter value from the code.

In ASP.Net, steps used are

Create a Data Set by right click on the project and select Add → New Item Then select Data → DataSet When the DataSet is added to the solution, right click on the DataSet Designer and select Add→TableAdapter. In that you need to provide the query to retrieve data and in this example I assume it as SELECT Name, Address, ContactNo FROM Users WHERE (Name LIKE @name + '%')@name is the parameter which we need to pass.Then add a new report and select the DataSet as the one which we created earlier.Then add a ReportViewer component and select the Report as the one created earlier. These steps are common for the Windows Forms as well. But next steps…

Get Week Numbers for Quarter and Month in SQL...

I needed to get the Week Number for the Month and the Quarter for a BI Application.
I was able to retrieve it using the below query.

SELECT DATEDIFF(WEEK, DATEADD(MONTH, DATEDIFF(MONTH, 0, '2012-03-17'), 0), '2012-03-17') +1 AS WeekNoMonth,DATEDIFF(WEEK, DATEADD(QUARTER, DATEDIFF(QUARTER, 0, '2012-03-17'), 0), '2012-03-17') +1 AS WeekNoQuarter

The results are WeekNoMonth=3 and WeekNoQuarter=11