Previous Page | Next Page

The SQL Procedure

EXECUTE Statement

Sends a DBMS-specific SQL statement to a DBMS that a SAS/ACCESS interface supports.
Requirement: SAS/ACCESS software is required. For more information on this statement, see your SAS/ACCESS documentation.
See also:

Connecting to a DBMS Using the SQL Procedure Pass-Through Facility in the SAS 9.2 SQL Procedure User's Guide

SQL documentation for your DBMS

EXECUTE (dbms-SQL-statement)
BY dbms-name|alias;



specifies an optional alias that is defined in the CONNECT statement. Note that alias must be preceded by the keyword BY.


identifies the DBMS to which you want to direct the DBMS statement (for example, ORACLE or DB2).


is any DBMS-specific SQL statement, except the SELECT statement, which can be executed by the DBMS-specific dynamic SQL. The SQL statement can contain a semicolon. The SQL statement can be case-sensitive, depending on your data source, and it is passed to the data source exactly as you type it.



The following example, after the connection, uses the EXECUTE statement to drop a table, create a table, and insert a row of data.

proc sql;
    execute(drop table ' My Invoice ') by db;
    execute(create table ' My Invoice '(
       ' Invoice Number ' LONG not null,
       ' Billed To '  VARCHAR(20),
       ' Amount '  CURRENCY,
       ' BILLED ON '  DATETIME)) by db;
    execute(insert into  ' My Invoice ' 
       values( 12345, 'John Doe', 123.45, #11/22/2003#)) by db;

Previous Page | Next Page | Top of Page