View Element Reference

< sql />

Explicitly specifies the SQL query to be run in order to provide data to the dataSource or mdx presentation elements. The parent element can contain multiple <sql> elements with unique dialect attribute values to define a single query in the specific SQL dialect where a particular database vendor uses non-standard syntax. Only one of the <sql> elements will be used depending on the configured database. In the context of an mdx view, if the <queryParameters> element is used, the query can contain a dynamic WHERE clause using one or more of the parameters. Otherwise the query is typically a simple SELECT columns FROM table statement.

<sql dialect="generic">
SELECT bl_id, fl_id, count(rm_id) AS rooms, sum(area) AS total_area
FROM rm GROUP BY bl_id, fl_id
</sql>
<sql dialect="oracle">
SELECT bl_id, fl_id, count(rm_id) rooms, sum(area) total_area
FROM rm GROUP BY bl_id, fl_id
</sql>

Enclosing Element: This tag can exist as a direct child of the <dataSource> element, or, in the context of an mdx view, as a direct child of the <query> or <range> element.
Encloses: This tag does not enclose any child XML elements, only containing the actual SQL text .
Attributes
Attribute Description Valid Values Optional
dialect Specifies the target database for which this query has been written. This attribute is useful when the query includes database-dependent functions or syntax generic, oracle, sqlserver yes