12.4.38    SQLEXECUTE

Description:   Executes  a  complete SQL command line placed in the buffer by a series of  SQLPREPARE commands.

Syntax:

Tcl:              SQLEXECUTE

JScript:         SQLEXECUTE();

VB Script:      SQLEXECUTE                     

 

Arguments:    none

Returns:        none

See Also:       SQLDIRECT, SQLPREPARE

Examples:               

# Tcl - WebDATA is an ODBC DSN attached to an Access Database

# COMPARE with SQLDIRECT entry

SQLDIRECT "CONNECT SESSION 1 TO WebDATA"

SQLDIRECT "USE SESSION 1"

# Tcl - Insert data into table

#For ODBC Databases that do not support level 2 commands (e.g. Access)

# break into two lines using SQL prepare

SQLPREPARE "INSERT INTO Table1 VALUES ('[GETVAL %TTMDATE]',"

SQLPREPARE "'[GETVAL %TTMTIME]', [GETVAL AMPLITUDE], [GETVAL TIMER])"

SQLEXECUTE

 

# Tcl - declare a pointer to newest data just entered

SQLPREPARE "DECLARE C1 CURSOR FOR SELECT '[GETVAL %TTMDATE]',"

SQLPREPARE "'[GETVAL %TTMTIME]', [GETVAL AMPLITUDE], "

SQLPREPARE "[GETVAL TIMER] FROM Table1"

SQLEXECUTE

SQLPREPARE "OPEN C1"

SQLEXECUTE

SQLPREPARE "FETCH NEXT C1 INTO text1, text2, text3, text4"

SQLEXECUTE

SQLDIRECT "CLOSE C1"

SQLPREPARE "DISCONNECT SESSION 1"

SQLEXECUTE

This command is used to execute an SQL command that is more than one line long.  An SQLPREPARE command must be used to form a complete SQL command line before an SQLEXECUTE.  SQLEXECUTE clears the buffer.  SQLPREPARE and SQLEXECUTE allow a single large SQL command to be written using multiple lines in a script.

SQLPREPARE with a SQLEXECUTE is the equivalent of a single SQLDIRECT command.  However, the Script editor effectively limits an SQLDIRECT command to 1000 characters.   For longer than 1000 characters on one SQL command line, use SQLPREPARE and SQLEXECUTE.  SQLPREPARE has a 16,000 (16k) character buffer limit.

SQLEXCUTE will interact with the related keymacro commands <SQLPREPARE> and <SQLDIRECT> allowing a script to initialize or open an SQL session and user keymacro commands to enter data..

WebAccess supports both Level 1 and Level 2 SQL statement.  SQL is an acronym for Structured Query Language.  Please refer to an SQL manual for complete syntax of the SQL language. These commands are used to interact with a Database file like Access or SQL Server through an ODBC DSN