I am trying to extract the sql from all my SSRS reports so I can see what database tables and columsn are used . Does anyone know how to do this if you have 50 reports ? Is there any exsiting functionality I have overlooked that does this ?

有帮助吗?

解决方案

The RDL files are simple XML files. You could create a simple parser that extracts the information you want. If you don't have access to the RDL files right now, you can download them through the SSRS web interface.

Here's an excerpt of the relevant part of an RDL file:

<DataSets>
<DataSet Name="Test">
  <Fields>
    <Field Name="Testfield">
      <DataField>Testfield</DataField>
      <rd:TypeName>System.DateTime</rd:TypeName>
    </Field>
  </Fields>
  <Query>
    <DataSourceName>MyDataSource</DataSourceName>
    <CommandType>StoredProcedure</CommandType>
    <CommandText>spMyGreatStoredProcedure</CommandText>
    <QueryParameters>
      <QueryParameter Name="@param1">
        <Value>=Parameters!Param1.Value</Value>
      </QueryParameter>
      <QueryParameter Name="@param2">
        <Value>=Parameters!Param2.Value</Value>
      </QueryParameter>
    <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
  </Query>
</DataSet>
</DataSets>

There are one or more DataSet blocks, which define one data set of the report. First, all the fields are defined and then the query with its parameters.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top