I'm using SSRS 2016 and have a number of users that will need to receive an emailed report by 11am respective to the users local time.
What's the best practice for doing this?
My initial thought was to just create different Active Directory distribution lists for each time zone and add the users accordingly...then create multiple schedules for each report and adjust the time of the report send time relative to the when the reports were needs for distribution list.
As an example, the SQL server is on central time while Eastern and Central time employees need a report by 11am local time. - Create an email schedule to send report to eastern time employees at 10am (server time) and again at 11am for the central time employees.
Is there a better way to do this?
Your approach is exactly what we are doing. The SQL Server instance is in the Central time zone, and we have users around the world. Each group maintains a mailing list, and manually does arithmetic when creating a report subscription. Interestingly enough, SSRS adjusts to local user's language (Le rapport hebdomadaire #ReportName a été exécuté à #ExecutionTime instead of #ReportName was executed at #ExecutionTime for the default subject), but offers nothing to help with time zones.
If you have an enterprise edition of SQL Server, you could use data driven report subscriptions. Given the big increase in cost between standard and enterprise editions, I doubt this one feature justifies the cost.
The other solution requires things outside of SSRS, but it can be handy. If you have other scheduling tools running in the various locations, they could run a PowerShell script to trigger the subscription. You could also use this approach to run reports when data is loaded, for example.
PowerShell script to list subscriptions and their IDs:
$server = 'http://server.company.com/reportserver'
$site = '/'
$rs2010 = New-WebServiceProxy -Uri "$server/ReportService2010.asmx" -Namespace SSRS.ReportingService2010 -UseDefaultCredential
$subscriptions = $rs2010.ListSubscriptions($site)
$subscriptions | Sort-Object -property path,owner,SubscriptionID -Unique | select Path, Owner, SubscriptionID
Powershell script to trigger subscription:
# Given an SSRS URL and a subscription ID, trigger the subscription.
$server = 'http://server.company.com/reportserver'
$subscriptionid = "55477447-b0b0-433c-a75f-08ad0b6d18bd"
$rs2010 = New-WebServiceProxy -Uri "$server/ReportService2010.asmx" -Namespace SSRS.ReportingService2010 -UseDefaultCredential ;
$rs2010.FireEvent("TimedSubscription",$subscriptionid,$null)
Related
I have SQL 2014 professional version 12.0.5000.0 with SSRS runing. eI have created a report in report builder 3.0 which works and runs find.
However when I go to create a subscription and run I get the user a1234 (as a example ) don't exist.
I looked there is no user with that name added to SSRS or in our domain.
my user name is ah1234 (as a example )
I looked in the subscription table and the owner is me ? However, the subscription is showing the owner as a1234?
I checked the report I uploaded it says the owner is a1234.
I'm thinking it might be a active directory issue but not sure.
Has anyone has see this before if so how can I fix the owner name of the subscription?
I don't know how SSRS has corrupted the owner name but here is a trick (written on 2008 R2) to correct owner names (I use this when people leave & their Active Directory user id gets deleted leaving orphaned subs that will not run).
Note that it updates the Microsoft-supplied subscriptions table, you may not wish to do that.
First identify the SSRS owner id for the from-person & also that of the to-person (you may need to get the to-person to create a subscription first):
SELECT distinct [OwnerID], u.username
FROM [<ssrs-database>].[dbo].[Subscriptions] s
join [<ssrs-database>].[dbo].[Users] u on s.ownerid = u.userid
Now make a safe copy of the subscriptions list, e.g.:
SELECT * into temp.subscriptionscpy
FROM [<ssrs-database>].[dbo].[Subscriptions] s
Now make the change, e.g. (this one changes the owner of all relevant subs):
update [<ssrs-database>].[dbo].[Subscriptions]
set ownerid = 'DDD87598-8957-42C8-8DBC-A893E7174CB6'
where ownerid = 'EBF0E483-69E6-4458-B171-BA28FFCCDF3F'
Now check the owner is as you want it.
We are running a custom app on Invantive Data Access Point which adds business functionality to Exact Online. For billing purposes, we would like to somehow register actual use of the software as defined in business terms instead of memory used, CPU, SQL statements executed, etc.
We do not yet have custom tables and I would like to keep it that way, so the whole state is kept in memory and in Exact Online only. So "insert into mytable#sqlserver..." is not an option. Neither does Exact Online offer the possibility to create custom tables as with Salesforce.
How can we somehow register billable events, such as "Performed an upload of 8 bank transactions" under this condition?
For billing purposes, you can lift along on the Customer Service infrastructure, which is similar to functionality offered by AWS or Apple for this purpose in their eco system. The "table" which stores the billing events like a Call Detail Record of a PBX is managed by Customer Service infrastructure.
There are two options:
Your apps use the default audit and license event registrations like "User logged on", "First use of partition #xyz", etc. each with a specific message code like 'itgenlic125'.
Your apps define their own event types like "Performed an upload of bank transactions", with a message code 'mybillingmessagecode123' and the number '8' as quantity in the natural key.
The first option is automatically and always done. These data is also used to manage resource consumption and detect runaways.
The second option is best done using Invantive SQL with the data dictionary table "auditevents". All records inserted into auditevents are automatically asynchronously forwarded to Customer Service. To see the current register audit events since start of application:
select *
from auditevents#datadictionary
where:
occurrence_date: when it happened.
logging_level: always "Audit".
message_code: code identifying the type of event.
data_container_d: ID of the data container, used with distributed SQL transactions.
partition: partition within the data container for platforms such as Exact Online or Microsoft SQL Server which store multiple databases under one customer/instance.
session_id: ID of the session.
user_message: actual text.
last_nk: last used natural key
application_name: name of the appplication.
application_user: user as known to the application.
gui_action: action within the GUI.
And some auditing and licensing information fields.
To register a custom event:
insert into auditevents#datadictionary select * from auditevents#datadictionary
Only some fields can be provided; the rest are automatically determined:
message_code
user_message
last_natural_key
application_name
application_user
gui_action
gui_module
partition
provider_name
reference_key
reference_table_code
session_id
To receive the billing events yourself from the infrastructure, you will need to access the Customer Service APIs or have them automatically forwarded to mail, Slack, RocketChat or Mattermost channel.
A sample SQL:
insert into auditevents#datadictionary
( message_code
, user_message
, last_natural_key
, application_name
, gui_action
, gui_module
, reference_key
, reference_table_code
, partition
)
select 'xxmycode001' message_code
, 'Processed PayPal payments in Exact Online for ' || divisionlabel user_message
, 'today' last_natural_key
, 'PayPalProcessor' application_name
, 'xx-my-paypal-processor-step-2' gui_action
, 'xx-my-payal-processor' gui_module
, clr_id reference_key
, 'clr' reference_table_code
, division partition
from settings#inmemorystorage
I've some questions regarding SSRS:
I want to create Account Statements of each client
Is it possible in SSRS to do so that I will pass AccountID as a parameter for each client, and it will form and save pdf files in C drive for each AccountID. How can I automate that?
I've e-mail table of each client. Is it possible to send account statements to clients according to this e-mail list? In other words, can I query recipients of account statements and send them an e-mail with their account statements.
Thanks
If you want to do this on a regular basis, you need to utilize a feature called Data Driven Subscription.
Basically, it looks at a table(Parameter, EmailAddress) in a SQL Server.
For instance, let's say you have:
ID - Name ------ Parameter ---------------- Email
1 - SalesGuy1 - 123123123 - SalesGuy1#emailaddress.com
2 - SalesGuy2 - 111111111 - SalesGuy2#emailaddress.com
3 - SalesGuy3 - 222222222 - SalesGuy3#emailaddress.com
It then, according to this table, executes with a parameter and sends report to appropriate user.
There is no short way of describing step-by-step, so please have a look at a well-written Microsoft KB article: https://technet.microsoft.com/en-us/library/aa237461%28v=sql.80%29.aspx
There is also slightly newer version (but basically the same content):
https://msdn.microsoft.com/en-us/library/ms169673.aspx
Note: You cannot use Shared Data source with data driven subscription. You have to configure email settings inside SSRS for this to work.
We have dozens of data driven subscriptions that we run manually at the beginning of the month that use file share delivery. They point to a certain server's shared drive.
That server is going away, so we need to either manually change the data driven sql that dynamically creates a path/filename for the dozens of subscriptions,
or we were hoping we could run an update statement or something? Below is kind of what we want to change. All instances of ATLACT02 to something else.
!!!!!!!!!!
Select 'Pro Bono Section ' + RTRIM(SECT_CODE) + ' ' + RTRIM(#PERIOD) AS 'FILE_NAME',
'\ATLACT02\Crystal Reports\Reports\Section\'+RTRIM(SECT_CODE) +'\'+ RTRIM(#PERIOD) AS 'PATH',
RTRIM(SECT_CODE) AS SECT,
RTRIM(#PERIODEND) AS PERIODEND,
RTRIM(#PERIODBEGIN) AS PERIODBEGIN
From _HBL_SECT SECT
Where SECT.INACTIVE = 'N' AND (SECT_CODE BETWEEN '100' AND '699')
AND SECT_CODE NOT IN ('101','201','301','401','501','601')
in your reporting services database
select * from Subscriptions where ExtensionSettings like '%ATLACT02%'
You can use some fancy TSQL to update the XML in that field or simply use the REPLACE
UPDATE Subscription
SET ExtensionSettings = REPLACE(ExtensionSettings,'ATLACT02','NewServerName')
WHERE ExtensionSettings like '%ATLACT02%'
Obviously a bit of testing would be pretty useful before attempting to change all your datadriven subscriptions
I have a report named "Debt Report ". It runs for every month and a pdf is generated at the first of the month by subscription option.
If I am running the report for the month then the report name of the pdf should be "Debt Report for April" and like wise if I run it for may then the name of the pdf should be "Debt Report for May".
How can I do this?
Assuming you are scheduling the report to a file share, you can set the name of the file share to be Debt Report for #timestamp - this will name the file in the format Debt Report for YYYY_MM_DD_HRMINSS .
If you only want the month name (not the entire timestamp) to appear in the filename, you will need to use a Data Driven Subscription.
Another option, although a bit more technical, is to use the rs.exe utility to generate the report. This involves:
creating a script file that generates the report (this is where you can set the filename to your preference)
creating a batch file that calls rs.exe with the script file as a parameter
running the batch file on a schedule e.g. with Windows scheduler or SQL Server Agent
There is an example here of how to do this (to create Excel files but the principle is the same) http://skamie.wordpress.com/2010/08/11/using-rs-exe-to-render-ssrs-reports/
The solution for this problem is "Data Driven Subscription"
http://msdn.microsoft.com/en-us/library/ms169972(v=sql.105).aspx
http://www.kodyaz.com/reporting-services/create-data-driven-subscription-in-sql-server.aspx
the following link helped me alot but the query given in the link creates trouble- cast the datatype of the getdate and it will solve the problem
http://social.msdn.microsoft.com/Forums/en/sqlreportingservices/thread/0f075d9b-52f5-4a92-8570-43bbdaf2b2b1
I have had to do the same thing ( well almost )
I had to generate a weekly report to file and save it as REPORT-Week01.pdf, then REPORT-Week02.pdf etc.
The mechanism I used was to change the parameter column in the Schedule table via a scheduled job. This computed the required file name and simply replaced it. Then when the scheduled job runs, it writes to the file name setup when the schedule was created ( except that was changed at 1 minute past midnight to what I wanted it to be )
I have since implemeted another set of reports that write to a folder, whihc changes each month the the next months folder name ( currently writing all reports to a folder called 202103 ) tonight the job will run and the output folder will change to 202104 and the scheduled jobs will never need changing