{"id":32,"date":"2015-09-27T16:57:00","date_gmt":"2015-09-27T23:57:00","guid":{"rendered":"\/lisa\/post\/2015\/09\/27\/Going-in-for-the-thrill.aspx"},"modified":"2021-11-24T11:22:14","modified_gmt":"2021-11-24T19:22:14","slug":"going-in-for-the-thrill","status":"publish","type":"post","link":"https:\/\/spacefold.com\/lisa\/2015\/09\/27\/going-in-for-the-thrill\/","title":{"rendered":"Going in for the thrill"},"content":{"rendered":"<p><a title=\"LSN on RDL documentation of privileges\" href=\"\/lisa\/2015\/08\/16\/Documentation-requires-rights-in-SSRS-but-who-has-them\/\" target=\"_blank\" rel=\"noopener\">Last time<\/a>, in what seems like my endless march towards documenting SSRS systems in a thorough way, I explained that I was going to go low-level to find out what SSRS artifacts my automation identity did not have privileges to read. &nbsp;If I didn&#8217;t know what objects on the server would cause a problem, as I trolled through the server contents to document it, how could I fix those privileges?<\/p>\n<p>I mentioned that the individuals who architect the SSRS system don&#8217;t like us to go into the base ReportServer tables to do stuff like this. &nbsp;We&#8217;re not supposed to. &nbsp;It&#8217;s not approved.<\/p>\n<h3>But the non-approved way is darn useful.<\/h3>\n<p>And, ladies and gents, we&#8217;re going to do it again.<\/p>\n<p>The only reason I had to know about the privileges for an automation identity was that I was going to use an automated method to call SSRS web service methods on every object, to document each one via the web service API, which is The Approved Way.<\/p>\n<h3>Suppose we just don&#8217;t care?<\/h3>\n<p>If we don&#8217;t mind going straight to the ReportServer tables, we can read all the RDLs directly from the Catalog, in one neat SQL statement &#8211; no web service calls required.<\/p>\n<p>Basically, just do this:<\/p>\n<div class=\"code\">use [YourReportServerDB]<br \/> go<\/p>\n<p> select Path,<br \/> &nbsp; &nbsp; &nbsp; cast(cast(Content AS varbinary(max)) As xml) as rdl_xml,<br \/> &nbsp; &nbsp; &nbsp; &#8212; if you prefer non-xml results, use varchar (nvarchar won&#8217;t work):<br \/> &nbsp; &nbsp; &nbsp; cast(cast(Content AS varbinary(max)) As varchar(max)) as rdl_text <br \/>from dbo.Catalog<br \/> &nbsp; &nbsp; &nbsp; where content is not null and type = 2<\/p>\n<p>&nbsp;<\/p><\/div>\n<h3>Et voil&agrave;<\/h3>\n<p>Sure, that just gives us the RDLs (type=2), but those report definitions are the lion&#8217;s share of what I was after; from there, parsing out the command texts so that we can find embedded query dependencies is duck soup. &nbsp;This task is the most critical reason to document SSRS installations thoroughly, IMHO. &nbsp;(Finding out the rest of the object types&#8217; contents from the Content field isn&#8217;t too hard to figure out in similar syntax anyway, I bet, if you want to do it.)<\/p>\n<p>And, sure it&#8217;s naughty. &nbsp;MS would rather we use the web service calls. You can sympathize. We&#8217;re tracking mud all over their nice clean architected floor.<\/p>\n<p>But going to the base tables of Report Server is a heck of a lot faster and more SQL-friendly. Some days, that just feels good.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last time, in what seems like my endless march towards documenting SSRS systems in a thorough way, I explained that I was going to go low-level to find out what SSRS artifacts my automation identity did not have privileges to read. &nbsp;If I didn&#8217;t know what objects on the server would cause a problem, as<a class=\"more-link\" href=\"https:\/\/spacefold.com\/lisa\/2015\/09\/27\/going-in-for-the-thrill\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-reporting","category-sql-server"],"_links":{"self":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":1,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":497,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/posts\/32\/revisions\/497"}],"wp:attachment":[{"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spacefold.com\/lisa\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}