Chapter Contents

Previous

Next
SAS/ACCESS Software for Relational Databases: Reference

SQL Procedure Pass-Through Facility: SYBASE Specifics

For a complete description of the PROC SQL statements, see SQL Procedure Pass-Through Facility Statements. The following section describes the SYBASE-specific arguments that you use in the CONNECT statement.


Arguments to Connect to SYBASE

The CONNECT statement establishes a connection with SYBASE. You establish a connection to send Transact-SQL statements to SYBASE or to retrieve SYBASE data. You can connect multiple times to one or more servers. After you establish a connection, it remains in effect until you issue a DISCONNECT statement or terminate the SQL procedure with a QUIT statement or begin a new DATA step or PROC step.

The CONNECT statement is optional. If omitted, the default values for all of the connection arguments are used.

CONNECT TO SYBASE <AS alias> <(connection-arguments)>;

Connection arguments for SYBASE are all case-sensitive. They are passed to SYBASE exactly as you type them. See Case Sensitivity in SYBASE for more information.

USER=username
specifies the SYBASE user ID that accesses the database. If you omit a username, your operating system account name is used, if appropriate for your operating environment.

PASSWORD=password
identifies the SYBASE password that is associated with the specified SYBASE user ID. If you omit a password, a default password of NULL is used.

PASSWORD= can also be specified with the SYBPW= alias.

DATABASE=database-name
identifies the database to use for the connection. If you omit this statement, the default database for your SYBASE username is used.

DATABASE= can also be specified with the DB= alias.

INTERFACE=file-name
specifies the name and location of the SYBASE interfaces file. The interfaces file contains the names and network addresses of all of the available servers on the network.

If you omit this statement, the default action for your operating system occurs. INTERFACE= is not used in some operating environments. Contact your DBA to determine whether it applies to your operating environment.

SERVER=server-name
identifies the server to which this connection is made. If you omit this statement, the default SYBASE action for your operating system occurs. On UNIX systems, the value of the environment variable DSQUERY is used if it has been set.

SYBBUFSZ=number-of-rows
specifies the number of rows of DBMS data to write to the buffer. If this statement is used, the SAS/ACCESS interface view engine creates a buffer that is large enough to hold the specified number of rows. This buffer is created when the associated database table is read. The interface view engine uses SYBBUFSZ= to improve performance.

If you omit this statement, no data is written to the buffer.


Pass-Through Example

The following example retrieves a subset of rows from the SYBASE INVOICE table. Because the WHERE clause is specified in the DBMS query (the inner SELECT statement), the DBMS processes the WHERE expression and returns a subset of rows to the SAS System.

proc sql;
connect to sybase(server=SERVER1 
                  database=INVENTORY
                  user=testuser password=testpass);
%put &sqlxmsg;

select * from connection to sybase
   (select * from INVOICE where BILLEDBY=457232);
%put &sqlxmsg;

Note:   The SELECT statement that is enclosed in parentheses is sent directly to the database and therefore must be specified using valid database variable names and syntax.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.