PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #import - Multi Line Records[Next]: #import - T2H

#import - SQL

This type of #Import directly accesses SQL databases such as MS Access 2000, MS SQL Server, mSQL or DB/2.

It requires a free 3rd party product called REXXSQL which can be obtained from Mark Hessling's site at "http://www.lightlink.com/hessling/REXXSQL/". To install RexxSQL you will need to follow its instructions but under Windows I simply copied the 2 DLLs into the system directory. PPWIZARD will inform you if it has problems finding the DLL.

This command is of course only supported on those operating systems that "RexxSQL" runs on (currently Windows, OS/2 and Unix). Check out Mark's pages for more details on the databases supported however this is a list (may not be complete) of databases known to work with RexxSQL:

This form of SQL import should be able to handle all or nearly all of your needs but if you need something more complex then you should check out the accessing SQL in rexx page.

If debug mode is on a lot of SQL related information is generated including a dump of all column information available on the columns returned by your query. PPWIZARD's debug mode (by default) also turns on REXXSQL debug so it should be quite easy to diagnose any problems you might have.

Field Information Parameters

The SQL import requires "FieldInfo" following the "DefineName" parameter.

You must specify field information for each column you want to handle from the data returned by your SQL query.

The field information is of the format "{ColName}TitleText".

The optional "ColName" parameter specifies the column name returned by your query while "TitleText" specifies the value for the title in the header record.

If a "ColName" is not specified then the "TitleText" is used for the column name as well. This would probably only be done if you either did not care about the title text in the header or you did not have a header.

DEFINITIONS/OPTIONS

If you can't understand how these options work then I suggest you try using /debug or #debug to watch what variables the import uses etc.

Example - Import From MS Access 2000 (ODBC)

Here is some sample code which accesses a access database via ODBC and creates a table of the contents (all default look and feel):

    ;--- Specify the query (this determines the rows and their columns) ---------
    #define IMPORT_SQL_QUERY                                   \
            SELECT * FROM [FullDetails]                        \
            WHERE DeptSeqNo > 4  and DeptSeqNo < 11            \
            ORDER BY Department.DepartmentDescription
    
    ;--- Perform the SQL import -------------------------------------------------
    #define IMPORT_SQL_DATABASE   PHASE2
    #import "" SQL ""                                              \
            "{DepartmentDescription}Department's<BR>Description"   \
            "{DeptSeqNo}Department<BR>Sequence<BR>Number"
    

The first parameter on the import command is normally a filename but for SQL this parameter should be "".

The following shows how you could have executed a couple of commands prior to the above query to generate the view that the above uses (not the best way, but good for an example):

    ;--- Define a query (probably better hardcoded in database but...) ----------
    #define DELETE_VIEW                                    \
            -drop table FullDetails
    #define CREATE_VIEW                                    \
            CREATE VIEW FullDetails AS                     \
            SELECT *                                       \
            FROM Department
    
    ;--- Do the above 2 commands after connecting to the database ---------------
    #define IMPORT_SQL_COMMANDS   \
            DELETE_VIEW           \
            CREATE_VIEW
    


[Top][Contents][Search][Prev]: #import - Multi Line Records[Next]: #import - T2H

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Monday January 22 2001 at 5:44pm