question

Slick84 avatar image
Slick84 asked

Any scripts available to quickly generate Report about SSRS reports/permissions/location on server

Hi,

Can some one point me to the right direction of finding a script which generates a report which includes all reporting services reports and the permissions they use along with their location on the server.

Thanks in advance, S

t-sqlssrsreportingscript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Oleg avatar image
Oleg answered

Report data is stored in the table named dbo.Catalog. Astonishingly, the Contents column which stores the RDL information has image data type (the very data type which Microsoft strongly encourages us to avoid). The workaround is to cast contents as XML friendly varbinary(max) which can then be cast to xml data type. Here is the script which will list all reports and their respective parameters, so if you run it you will get multiple records per report if the latter has multiple parameters:

select 
    [name] ReportName, [path] ReportPath,
    item.value('@Name', 'varchar(100)') as ParameterName,
    item.value('DataType[1]', 'varchar(100)') as DataType,
    isnull(item.value('AllowBlank[1]', 'varchar(5)'), 'false') as AllowBlank,
    isnull(item.value('Prompt[1]', 'varchar(100)'), '') as Prompt,
    isnull(item.value('Hidden[1]', 'varchar(100)'), 'false') as Hidden,
    item.value('data(DefaultValue/Values/Value)[1]', 'varchar(100)') as ParameterValue
    from 
    (
        select
            [Path], [Name], cast(cast([Content] as varbinary(max)) as xml) as ReportXml 
            from dbo.Catalog 
            where [Content] is not null and [Type] = 2
    ) Reports 
    cross apply ReportXml.nodes('/Report/ReportParameters/ReportParameter') items(item)
    order by 1;

All tables in the ReportServer database are very straightforward, i.e. dbo.ReportSchedule relates to dbo.Schedule and dbo.Catalog via ScheduleID - > ScheduleID and ReportID -> ItemID respectively.

Oleg

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.