I have hundreds of reports that are deployed in MSSQL reporting server. In which few of the reports has embedded datasource and the rest has shared datasource. Is there is any query or easy method to differentiate the reports that have shared and embedded datasource?
You can use the following query:
WITH XMLNAMESPACES(DEFAULT 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition')
SELECT C.Name,
CONVERT(XML,CONVERT(VARBINARY(MAX),C.Content)).exist('/Report/DataSources/DataSource/ConnectionProperties') AS EmbeddedSourcePresent,
CONVERT(XML,CONVERT(VARBINARY(MAX),C.Content)).exist('/Report/DataSources/DataSource/DataSourceReference') AS SharedSourcePresent
FROM ReportServer.dbo.Catalog C
WHERE C.Content is not null
AND C.Type = 2
You might need to change your namespace according to your ssrs version. I hope this helps.
Related
I have tried various queries I have found to try and accomplish this and none of them seem to list all the batch file/subscription instances tied to a user report in SSRS. If there is already a batch file out there tied to a user report, that's what I want to use versus creating a new batch file. I have tried going through the tables in the ReportServer database and looking for records to link to try and find this information, but I have been unsuccessful. Sorry if this is a simplistic question, but I have spent a few days trying to figure this out. Thank you!
You should be able to get at all subscriptions on your report server by running the following query:
You can alter this to suit your needs
use [ReportServer]
SELECT
R.Name
, L.TimeDataRetrieval
,L.TimeProcessing
,L.TimeRendering
, L.TimeDataRetrieval+L.TimeProcessing+L.TimeRendering AS TotalTime
,L.Format
,L.[Parameters]
,L.username
,L.TimeStart
,L.TimeEnd
,l.ReportID
,DATEDIFF(SECOND,L.timestart,L.timeend) time_seconds
,r.Path
FROM dbo.ExecutionLog L
INNER JOIN dbo.Catalog R
ON L.ReportID = R.ItemID
WHERE
R.Name like 'name of your report'
Is it possible (if Yes - how) to retrieve data from SSRS dataset that has been published to the ReportServer ?
I have is Azure reporting services setup, and published a DataSource, DataSet, and a report that work perfectly fine.
What I want - is to be able to access that "published DataSet" - like some sort of a XML API ?
Say hit some URL with params from a browser, and get a XML result with Data from that DataSet
The problem you will run into is the rsd (datasetFile) is not much itself but a query and for that reason publishing the proxy services of ReportService2010 will get you the data but you still have to then handle the XML shredding. It is much, much easier to get the data from the dataset through querying the 'ReportServer' IMHO in SQL directly. Rather than making the models from the proxy classes, getting the data from invoking those classes, then you have xml you still have to query to get your data.
Example with word of warning: (This may only work with my example of datasets not other catalog items):
use ReportServer
GO
Select
Path
, Name
, Content
, cast( cast(Content as varbinary(max)) as xml) as ContentAsXML
, cast(
cast(Content as varbinary(max))
as xml)
.query('declare namespace a="http://schemas.microsoft.com/sqlserver/reporting/2010/01/shareddatasetdefinition";
/a:SharedDataSet/a:DataSet/a:Query/a:CommandText')
.value('.', 'varchar(max)') as QueryStatement
from dbo.Catalog
where type = 8
Based on this guy's writing:
http://bretstateham.com/extracting-ssrs-report-rdl-xml-from-the-reportserver-database/
If you decide you just must use the proxy classes you will have to remember to invoke the namespace and I did an Xdocument method with C# to get the data. Don't have the dataset but I did the Datasource which will be a similar method. You mainly do this method in a foreach loop for each dataset you want. Keep in mind YOUR NAMESPACE for 2008 or 2005 will differ:
private List<string> GetDataSourceRefs(string aSourceLocation)
{
var xdoc = XDocument.Load(aSourceLocation);
// Need a namespace or else the xml elements will not be properly identified. Default below is for 2012 ONLY.
XNamespace ns = XNamespace.Get("http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition");
return xdoc.Descendants(ns + "DataSource")
.Elements(ns + "DataSourceReference")
.Select(x => x.Value)
.ToList();
}
Use ReportExecution2005 proxy class - you can execute the report and get it in the XML format. I'm not sure but I think you should be able to execute datasets too. You can read more about it here:
Generate reports programmatically using the TFS API and SSRS
Is it possible to get the files for a deployed reports ON SSRS 2005?
On of our developers deployed them to the Reporting Server, but didn't commited his changes to SVN. Now we are in an inconsistent state and we also can't find the files he created.
In Report Manager (usually the URL ends with /Reports or /Reports_instanceName ) You can look at the details of reports. The Edit button will allow you to download the .rdl definition files.
From
http://msdn.microsoft.com/en-us/library/ms156032(v=sql.90).aspx
In the Report Definition section, click Edit to extract a copy of the report definition. Modifications that you make locally to the report definition are not saved on the report server.
(I should have also noted, the interface and the button name change in SSRS 2008, so these instructions are specific to SSRS 2005.)
use ReportServer
go
create view vwReportDataSet_SharedDataSet_Mapping
as
select ds.itemid, ds.name as Report_DataSource,
cat.name as Shared_DataSource
from datasets ds
inner join catalog cat on ds.linkid = cat.itemid
go
create view vwSharedDataset_Usage
as
select cat.path,
cat.name,
cat.type,
ds.Report_DataSource,
ds.Shared_DataSource
from
catalog cat
left join vwReportDataSet_SharedDataSet_Mapping ds
on cat.itemid = ds.itemid
This SQL gives you your report dataset usage.
select * from vwSharedDataset_Usage
where type = 2
and path like '/SIT/%'
and name in ('Report1','Report2')
I have designed a SSRS report having multiple sub-reports. The report is working fine but displaying data for all records.
But my need is to make it context sensitive.
Below is the query for the main report.
SELECT Filterednew_franchisee.new_franchiseeid,
Filterednew_franchisee.new_name,
Filterednew_monthlypayment.new_insurance
FROM Filterednew_franchisee
INNER JOIN Filterednew_monthlypayment
ON Filterednew_franchisee.new_franchiseeid =
Filterednew_monthlypayment.new_franchiseeid
WHERE (Filterednew_monthlypayment.new_yearmonth =
#reportyear + #reportmonth)
AND (Filterednew_franchisee.new_franchiseeid IN
(select new_franchiseeid
from Filterednew_franchisee as CRMAF_Filterednew_franchisee))
Sub-reports are using the fields from the above query as parameter.
Am I missing something ? Is there any other approach that needs to be followed? Is it really possible to design a context sensitive report having multiple sub-reports?
Please help.
Yes, context-sensitive reports are possible. The name Filtered as in Filterednew_franchisee refers to a SQL Server view that is designed for the sake of security roles. To gain access to context-sensitive views, the API takes an arbitrary prefix called CRMAF_ and translates it into a context-sensitive query.
Thankfully, the SDK includes a sample view (which I've copied below).
SELECT
CRMAF_FilteredActivityPointer.activitytypecodename as activitytypecodename,
CRMAF_FilteredActivityPointer.regardingobjectidname as regardingobjectidname,
CRMAF_FilteredActivityPointer.subject as subject,
CRMAF_FilteredAccount.name
FROM FilteredActivityPointer AS CRMAF_FilteredActivityPointer
INNER JOIN FilteredAccount As CRMAF_FilteredAccount on
CRMAF_FilteredAccount.accountid =
CRMAF_FilteredActivityPointer.regardingobjectid
When I haved developed a Reporting Services report and deployed it to the server, where is the actual report stored? I'm guessing the SQL-database, but what table and in what format?
AFAIK, it is typically stored in the ReportServer database in the dbo.Catalog table.
Here is a Query which will get you the XML for the report. I have used this to feed a PowerShell script which replaces all of the current footers with a standardized footer for the company.
SELECT f.[Name] as Module,
r.[Name],
CAST(CAST(r.[Content] AS VARBINARY(MAX)) AS XML) AS reportXML
FROM dbo.[Catalog] r WITH (NOLOCK)
JOIN dbo.[Catalog] f WITH (NOLOCK) ON r.ParentID = f.ItemID
and f.[Type] = 1
and f.path like '[your_path]%'
WHERE r.[Type] = 2
and r.path like '[your_path]%'
ORDER BY r.[name]
This will give you an XML column you can click-on and the XML will be displayed for you.