<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scheduled Refresh notifications (On-Premise) in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391327#M4937</link>
    <description>&lt;P&gt;FYI, I found the SQL AGent job (labeled as GUID&amp;nbsp;87B024E7-A122-4DE9-818A-8016826EB9E3) in SQL Agent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It shows as successful this morning. But the data refresh shows error on Power BI front end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it appears SQL Agent failures do NOT occur when the data refresh fails.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2018 17:29:36 GMT</pubDate>
    <dc:creator>xantari</dc:creator>
    <dc:date>2018-04-06T17:29:36Z</dc:date>
    <item>
      <title>Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391220#M4931</link>
      <description>&lt;P&gt;We can not find a way to get Refresh Notification failure emails when a scheduled data refresh occurs on-premise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apparently this has existed for a long time on Power BI (because they have to deal with a lot more data connectivity issues with the gateway service I am guessing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where is this function in the on-premise version? As it is important on-premise as it is on cloud service.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 14:58:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391220#M4931</guid>
      <dc:creator>xantari</dc:creator>
      <dc:date>2018-04-06T14:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391307#M4934</link>
      <description>&lt;P&gt;In Power BI report Server, every schedule you create goes to SQL Server Agent JOB, so you can go to the SQL Server Agent JOB and then you can add one more step after the current step for sending the email. You might need to configure email in SQL in order to send the email through JOB.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 16:58:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391307#M4934</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-06T16:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391322#M4935</link>
      <description>&lt;P&gt;WHich one of the 150 SQL Agent jobs do I do that on. They are just labeled as a GUID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This doesn't seem like a good solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Microsoft needs to fix this if there is no other way. Why don't they just add a task at the end of these SQL Agent jobs for the server administrator if it is setup in the Power BI Server backend?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like basic functionality is missing here.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 17:27:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391322#M4935</guid>
      <dc:creator>xantari</dc:creator>
      <dc:date>2018-04-06T17:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391327#M4937</link>
      <description>&lt;P&gt;FYI, I found the SQL AGent job (labeled as GUID&amp;nbsp;87B024E7-A122-4DE9-818A-8016826EB9E3) in SQL Agent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It shows as successful this morning. But the data refresh shows error on Power BI front end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it appears SQL Agent failures do NOT occur when the data refresh fails.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 17:29:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391327#M4937</guid>
      <dc:creator>xantari</dc:creator>
      <dc:date>2018-04-06T17:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391542#M4946</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="48074" data-lia-user-login="xantari" class="lia-mention lia-mention-user"&gt;xantari&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can create your idea for this on the below URL and keep voting for the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://ideas.powerbi.com/forums/265200-power-bi-ideas" target="_blank"&gt;https://ideas.powerbi.com/forums/265200-power-bi-ideas&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2018 04:25:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/391542#M4946</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-07T04:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/392459#M4972</link>
      <description>&lt;P&gt;The problem is the call to the subscription succeeds though the subscription itself fails. Which is, as you say, a bit rubbish!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add a second SQL Step to each SQLAgentJob and basically force a failure using some code like the stuff below. You can then just add your "operators" to the Notifications for the SQL Agent job and set the first step up to call the second on success and both steps to Fail the job!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will generate a SQL Agent ALERT to the operators!&amp;nbsp; You could of course log the details of the query into a table somewhere&amp;nbsp; before you call RAISEERROR so you would have the details of what had failed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Figuring out why the **bleep** thing failed is another matter entirely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DECLARE @SQLAgentJobID UNIQUEIDENTIFIER;


SET @SQLAgentJobID = CONVERT(uniqueidentifier, $(ESCAPE_NONE(JOBID)));

IF EXISTS(

	SELECT	sj.name AS SQLAgentJobName
		   ,c.Name AS ReportName
		   ,c.[Path] AS ReportPath
		   ,s.[Description] AS SubscriptionName
		   ,rs.SubscriptionID
		   ,s.LastStatus
		   ,s.EventType
		   ,s.LastRunTime
		   ,sj.date_created
		   ,sj.date_modified
	FROM	ReportServer.dbo.ReportSchedule rs
			INNER JOIN msdb.dbo.sysjobs sj
				ON rs.ScheduleID = CAST(sj.name AS UNIQUEIDENTIFIER)
				   AND 101 = sj.category_id
			--INNER JOIN ReportServer.dbo.ReportSchedule c
			--    ON CAST(sj.name AS uniqueidentifier) = c.ScheduleID
			INNER JOIN ReportServer.dbo.Subscriptions s
				ON rs.SubscriptionID = s.SubscriptionID
			INNER JOIN ReportServer.dbo.[Catalog] c
				ON s.Report_OID = c.ItemID
	-- to find specific report last status 
	-- WHERE e.name = 'Usage Stats'
	-- to find failed status
	WHERE	LastStatus &amp;lt;&amp;gt; 'Completed Data Refresh'
	-- for a specific SQL Agent Job
			AND sj.name = @SQLAgentJobID)
BEGIN
	--LOG the query results above to something if you want a simple way of finding out what has failed&lt;BR /&gt;        RAISERROR('Data Refresh Failed!',16,1);
END
-- NOTE you have to look in subscription history for any error messages/details (good luck with that!)&lt;/PRE&gt;&lt;P&gt;PS Have I mentioned how shoddy and third rate the logging and monitoring is for PBI SSRS Server?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 13:48:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/392459#M4972</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-09T13:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/392490#M4974</link>
      <description>&lt;P&gt;I have just realised that there is a "magic number" in that SQL that makes it work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;INNER JOIN msdb.dbo.sysjobs sj
				ON rs.ScheduleID = CAST(sj.name AS UNIQUEIDENTIFIER)
				   AND 101 = sj.category_id&lt;/PRE&gt;&lt;P&gt;the 101 is the category_id of the Job Category called "Report Server"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can find these using the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;USE msdb
GO

SELECT * FROM dbo.syscategories&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think 101 is safe on most systems but it may well be different on your installation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 14:14:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/392490#M4974</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-09T14:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/393068#M4996</link>
      <description>&lt;P&gt;Thanks much&amp;nbsp;Anonymous&lt;/a&gt;, for the info. Much Appriciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 09:16:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/393068#M4996</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-10T09:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/393131#M4999</link>
      <description>&lt;P&gt;I extended the query above slightly in the following post to show the errors that are recorded by the refresh process&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Report-Server/Power-BI-Report-Server-unable-to-Refresh-Reports/m-p/392772/highlight/false#M4988" target="_self"&gt;Data Refresh Fail&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 10:13:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/393131#M4999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-10T10:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/434897#M6029</link>
      <description>&lt;P&gt;Please use the below query and schedule it through SQL Server Agent to notify/email certain users if a Data Refresh failure happens and that will notify you if a data refresh did not run successfuly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;SELECT Subscriptions.Description,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.LastStatus,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.EventType,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;MAX(SubscriptionHistory.StartTime) start_time,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;MAX(SubscriptionHistory.EndTime) end_time,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Message,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Details&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;FROM subscriptions&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;JOIN dbo.SubscriptionHistory &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;ON Subscriptions.SubscriptionID = SubscriptionHistory.SubscriptionID &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;WHERE CAST(StartTime AS Date) = CAST(GETDATE() AS DATE)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;GROUP BY Subscriptions.Description,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.LastStatus,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.EventType,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Status,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Message,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Details&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;HAVING Subscriptions.LastStatus LIKE 'Data Refresh failed%'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Note:&lt;/U&gt; &lt;FONT color="#FF0000"&gt;This query will be run in the BI Database that has the metadata for the Power BI Report Server.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 17:53:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/434897#M6029</guid>
      <dc:creator>adestarBI23</dc:creator>
      <dc:date>2018-06-07T17:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/434899#M6030</link>
      <description>&lt;P&gt;Please use the below query and schedule it through SQL Server Agent to notify/email certain users if a Data Refresh failure happens and that will notify you if a data refresh did not run successfuly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;SELECT Subscriptions.Description,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.LastStatus,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.EventType,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;MAX(SubscriptionHistory.StartTime) start_time,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;MAX(SubscriptionHistory.EndTime) end_time,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Message,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Details&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;FROM subscriptions&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;JOIN dbo.SubscriptionHistory &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;ON Subscriptions.SubscriptionID = SubscriptionHistory.SubscriptionID &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;WHERE CAST(StartTime AS Date) = CAST(GETDATE() AS DATE)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;GROUP BY Subscriptions.Description,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.LastStatus,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Subscriptions.EventType,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Status,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Message,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;SubscriptionHistory.Details&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;HAVING Subscriptions.LastStatus LIKE 'Data Refresh failed%'&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Note:&lt;/U&gt; &lt;FONT color="#FF0000"&gt;This query will be run in the BI Database that has the metadata for the Power BI Report Server.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jun 2018 18:01:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/434899#M6030</guid>
      <dc:creator>adestarBI23</dc:creator>
      <dc:date>2018-06-07T18:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/435186#M6034</link>
      <description>&lt;P&gt;This is my solution as second step in SQL Agent.&amp;nbsp;Preliminarily you should configure MS SQL MAIL and find out GUID of your&amp;nbsp;Catalog.ItemID = '????'. This step sends notification by mail after successfully refreash data (1 step) to all users of this report&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DECLARE	
	@xml  XML,
	@str varchar(8000) = ''
SELECT @xml = CAST(XmlDescription as XML)
FROM Catalog WITH (NOLOCK)
INNER JOIN Policies WITH (NOLOCK) ON Catalog.PolicyID = Policies.PolicyID
LEFT OUTER JOIN SecData WITH (NOLOCK) ON Policies.PolicyID = SecData.PolicyID AND AuthType = 1
WHERE Catalog.ItemID = 'E3280AC8-EFF4-4AF6-8ED3-583C6112139A' 
AND PolicyFlag = 0
declare
	@t table (mail_to varchar(100))
SET QUOTED_IDENTIFIER ON;
insert 
	@t
SELECT	xmlData.A.value('.', 'VARCHAR(100)') AS mail
FROM	@xml.nodes('Policies/Policy/GroupUserName') xmlData(A)
delete @t
where mail_to = 'BUILTIN\Administrators'
update @t
set mail_to = REPLACE(REPLACE(mail_to, 'KCELL.KZ\',''), '@kcell.kz','') + '@kcell.kz'

SELECT @str = @str + ISNULL(t.mail_to + ';', '') FROM @t t

SET @str = SUBSTRING(@str, 1, LEN(@str) - 1)

WAITFOR DELAY '00:10:00'; 

DECLARE @body NVARCHAR(MAX)
SET @body = '
&amp;lt;html&amp;gt;
	&amp;lt;body&amp;gt;
		&amp;lt;H2&amp;gt;Daily RSSS-OU-CCHT statistics&amp;lt;/H2&amp;gt;
		&amp;lt;H3&amp;gt;Data were updated successfully!&amp;lt;/H3&amp;gt;
		&amp;lt;p&amp;gt;&amp;lt;a href="http://192.168.223.13/Reports/powerbi/CCD%20reports/Daily%20RSSS-OU-CCHT%20statistics"&amp;gt;Open report&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;
	&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;'

EXEC msdb.dbo.sp_send_dbmail  
    @profile_name = 'power_bi_report_server',
    @recipients = @str,
    @copy_recipients = 'your_name@kcell.kz',
    @body = @body,
    @subject = 'Power BI Report Server Alert',
    @body_format = 'HTML';&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 03:50:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/435186#M6034</guid>
      <dc:creator>agent_007</dc:creator>
      <dc:date>2018-06-08T03:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Scheduled Refresh notifications (On-Premise)</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/3120919#M29128</link>
      <description>&lt;P&gt;Please vote for this: &lt;A href="https://ideas.powerbi.com/ideas/idea/?ideaid=a9ac0d7b-4a95-ec11-826d-501ac50aa35e" target="_blank"&gt;https://ideas.powerbi.com/ideas/idea/?ideaid=a9ac0d7b-4a95-ec11-826d-501ac50aa35e&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Mar 2023 08:46:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Scheduled-Refresh-notifications-On-Premise/m-p/3120919#M29128</guid>
      <dc:creator>georgzeplin</dc:creator>
      <dc:date>2023-03-09T08:46:15Z</dc:date>
    </item>
  </channel>
</rss>

