Previous Page | Next Page

LIBNAME Statement and Pass-Through Facility for PC Files on Microsoft Windows

EXECUTE Statement



Sends data source-specific, non-query SQL statements to the data source.
Valid in: PROC SQL steps

Syntax
Arguments
Details
Useful Statements to Include in EXECUTE Statements
Example

Syntax

EXECUTE (data-source-specific-SQL-statement) BY data-source-name | alias;


Arguments

(data-source-specific-SQL-statement)

a dynamic non-query, data source-specific SQL statement. This argument is required and must be enclosed in parentheses. The SQL statement cannot contain a semicolon because a semicolon represents the end of a statement in SAS. Depending on your data source, the SQL statement can be case-sensitive. The statement is passed to the data source exactly as you type it.

Any return code or message that is generated by the data source is available in the macro variables SQLXRC and SQLXMSG after the statement executes.

See: Syntax for the Pass-Through Facility for PC Files
data-source-name

identifies the data source to which you direct the data source-specific SQL statement. The keyword BY must appear before the data-source-name argument. You must specify either the data source name or an alias.

alias

specifies an alias that was defined in the CONNECT statement. (You cannot use an alias if the CONNECT statement is omitted.)


Details

The EXECUTE statement sends dynamic non-query, data source-specific SQL statements to the data source and processes those statements.

The EXECUTE statement cannot be stored as part of a Pass-Through Facility query in a PROC SQL view.


Useful Statements to Include in EXECUTE Statements

You can pass these statements to the data source by using the Pass-Through Facility EXECUTE statement.

CREATE

creates a data source table, view, index, or other data source object, depending on how the statement is specified.

DELETE

deletes rows from a data source table.

DROP

deletes a data source table, view, or other data source object, depending on how the statement is specified.

INSERT

adds rows to a data source table.

UPDATE

modifies the data in the specified columns of a row in a data source table.

For more information about these and other SQL statements, see the SQL documentation for your data source.


Example

This example uses the EXECUTE statement to drop a table, create a table, and insert a row of data after the connection:

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