Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSRS EMail Data-Driven Subscriptions.. File Name need to be changed dynamically.


SSRS EMail Data-Driven Subscriptions.. File Name need to be changed dynamically.

Author
Message
etirem
etirem
SSC Journeyman
SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)SSC Journeyman (80 reputation)

Group: General Forum Members
Points: 80 Visits: 517
We have the option of changing File Name dynamically in "Windows File Share" delivery method in Data-Driven Subscriptions but is it possible in E-Mail delivery method?
krzysztof.ostrowski
krzysztof.ostrowski
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2077 Visits: 380
Yes Smile

1 create manualy subscription and run it
2 create job whit command eg:

-- This procedure get data from table [name and email adres] then update subscription and run subscription, wait 60 secends and get next value from table

BEGIN
DECLARE @wysylka varchar(max)
DECLARE @oddzial varchar(200)
declare @sql nvarchar(max)
declare @email nvarchar(500)
DECLARE wysylka_crs cursor for SELECT [Branch],[Adres_email]
FROM [RPT].[Emails]


OPEN wysylka_crs
Set @oddzial = ' '
WHILE( @@FETCH_STATUS = 0)
begin
if @oddzial <>' '
begin

UPDATE REPORTSERVER.DBO.SUBSCRIPTIONS
SET ExtensionSettings = '<ParameterValues><ParameterValue><Name>TO</Name><Value>'+@email+'</Value></ParameterValue><ParameterValue><Name>IncludeReport</Name><Value>True</Value></ParameterValue><ParameterValue><Name>RenderFormat</Name><Value>MHTML</Value></ParameterValue><ParameterValue><Name>Subject</Name><Value>@ReportName dla oddzialu: '+@oddzial+' wygenerowany: @ExecutionTime </Value></ParameterValue><ParameterValue><Name>IncludeLink</Name><Value>False</Value></ParameterValue><ParameterValue><Name>Priority</Name><Value>NORMAL</Value></ParameterValue></ParameterValues>'
WHERE SUBSCRIPTIONID = '8597C181-AE56-4ED7-B6E3-E9939B858C6E'
EXEC ReportServer.dbo.AddEvent @EventType='TimedSubscription', @EventData= '8597C181-AE56-4ED7-B6E3-E9939B858C6E'
WAITFOR DELAY '00:01:00'

end
FETCH NEXT FROM wysylka_crs INTO @oddzial,@email
end
CLOSE wysylka_crs
DEALLOCATE wysylka_crs
END
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search