htmSQL Input Files

Overview of htmSQL Input Files

To create your Web page, you must first provide htmSQL with an input file. This file contains the HTML and SQL that you want processed.
When someone wants to access your Web page, they pass a URL that contains the name and location of the input file to htmSQL. The URL can also contain information used to resolve variable references that are in the input file.

General Structure of an htmSQL Input File

An input file can contain zero or more of the following elements:
  • variable references. The references can be to columns selected in queries, to variables specified in the URL, or to variables that htmSQL automatically defines and supplies values for. The references are replaced by the current value of the variable.
  • complete query sections, delimited by the {query} and {/query} directive pair. Each query section contains at least one SQL/eachrow section pair and can contain multiple pairs. For each SQL section, you can include a norows section.
    • The SQL section is delimited by the {sql} and {/sql}directive pair and specifies how to construct a query that htmSQL sends to a SAS/SHARE server.
    • The eachrow section is delimited by the {eachrow} and {/eachrow} directive pair and describes how to display the results set.
    • The norows section is delimited by the {norows} and {/norows} directive pair and contains the steps to take when the previous SQL section does not return any rows.
  • complete update sections, delimited by the {update} and {/update} directive pair. Each update section contains one or more SQL sections. For each SQL section, you can include success and error sections.
    • The SQL section is delimited by the {sql} and {/sql}directive pair and specifies how to construct an SQL statement that htmSQL sends to a SAS/SHARE server.
    • The success section is delimited by the {success} and {/success} directive pair and contains the steps to take when the SQL is processed with a return code of zero. The success section can also contain a norows section.
    • The error section is delimited by the {error} and {/error} directive pair and contains the steps to take when the SQL is processed with a nonzero return code.
  • {library} directive. The {library} directive can be included in both the query and update sections and defines a high-level qualifier that you use in the names of tables and views in your SQL queries and statements.
  • {label} directive. The {label} directive enables you to display the label for a column in a results set.
  • included files. Use the {include} directive to specify another file for htmSQL to process before continuing with the current file.
  • htmSQL comments. All text contained between {* and a closing brace } is considered an htmSQL comment and is not written to stdout.
Everything else in the input file is written, as is, to stdout. This includes text, HTML, and newline characters.