ImportSQLFile (Method)

Applies To:

QuerySection

Description:

Imports a complete SQL statement from a text file to a query, and retrieves the data set from the database server. Files you import are scanned to determine the number of columns returned by the SQL. The request line is populated with indicators for each column. This enables you to use existing SQL statements.

Before using this method, perform these tasks:

When the SQL file imports, you can drag items from the table to the Request line, use the Custom SQL feature, or display its properties. You cannot edit the imported SQL file, but you can specify a user-friendly Request line item name and identify the data type.

Syntax:

Expression.ImportSQLFile(Filename As String,numColumns As Number, [optional] BqEncoding Encoding)

Expression Required:

An expression that returns a Query object

Constants:

The ImportSQLFile (Method) uses the BqEncoding constant group, which includes:

Example:

This example shows how to set the imported SQL file name, and process the query:

var Filename = "C:\\Program Files\\Hyperion\\BIPlus\\docs\Samples\\SQLLoad\\SalesData.sql"
var MySection = ActiveDocument.Sections["Query"].ImportSQLFile(Filename, 2)
ActiveDocument.Sections["Query"].Process()