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:
Connect to the database server.
Ensure that the Query section to which you import SQL does not have tables.
Ensure that the SQL file begins with a SELECT statement
You know how many columns to display in the Results section.
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.
Expression.ImportSQLFile(Filename As String,numColumns As Number, [optional] BqEncoding Encoding)
An expression that returns a Query object
The ImportSQLFile (Method) uses the BqEncoding constant group, which includes:
bqEnc_Arabic_ISO
bqEnc_Arabic_Windows
bqEnc_Baltic_ISO
bqEnc_Baltic_Windows
bqEnc_CentralEuropean_ISO
bqEnc_CentralEuropean_Windows
bqEnc_Chinese_BIG5
bqEnc_Chinese_GB2312
bqEnc_Chinese_HZ
bqEnc_Cyrillic_DOS
bqEnc_Cyrillic_ISO
bqEnc_Cyrillic_KOI8R
bqEnc_Cyrillic_KOI8U
bqEnc_Greek_ISO
bqEnc_Greek_Windows
bqEnc_Hebrew_Windows
bqEnc_Japanese_EUC
bqEnc_Japanese_JIS
bqEnc_Korean
bqEnc_Thai_Windows
bqEnc_Turkish_ISO
bqEnc_Turkish_Windows
bqEnc_Unicode
bqEnc_Unicode_UTF16
bqEnc_Unicode_UTF16_BigEndian
bqEnc_Unicode_UTF16_LittleEndian
bqEnc_Unicode_UTF32
bqEnc_Unicode_UTF32_BigEndian
bqEnc_Unicode_UTF32_LittleEndian
bqEnc_Unicode_UTF8
bqEnc_Vietnamese_Windows
bqEnc_WesternEuropean_ISO
bqEnc_WesternEuropean_Windows
This example shows how to set the imported SQL file name, and process the query: