Problem Note 7450: Example of using PROC SQL Pass-through to execute a stored procedure and
return an output parameter
The following is an example of using PROC SQL Pass-through statements
with SAS/ACCESS Interface to ODBC to execute a stored procedure and
return an integer as an output parameter to SAS. It uses a temporary
table to store the value from the output parameter:
proc sql;
connect TO ODBC (dsn=mydsn uid=myuid pwd=mypwd);
execute (declare @vCount int exec myproc 4, @vCount Output create
table #mytemp(col1 int) insert into #mytemp values (@vCount)) by
ODBC;
select col1 into : mID from connection to ODBC(select * from #mytemp);
quit;
This is an example of reading data. To update a temp table, you would
need to install a hotfix and use the CONNECTION=GLOBAL or
CONNECTION=SHARED option to accomplish this (see SAS Note #006323 ).
There is a CONNECTION=SHARED_READ option (default) that is only used for
reading and not writing/updating data, so development provided a hotfix
to support the CONNECTION=GLOBAL and CONNECTION=SHARED option.
Example:
libname myodbc odbc dsn=sqlserver2000 uid=dbitest pwd=dbigrp1
connection=global;
proc sql;
create table myodbc.'#tmp'n as select * from sashelp.class;
select * from myodbc.'#tmp'n;
quit;
Without the hotfix, the CONNECTION=GLOBAL or CONNECTION=SHARED option is
invalid. You must have this option or the libname works as follows:
proc sql;
create table myodbc.'#tmp'n as select * from sashelp.class;
In this example, the connection is made to the dbms, the table is
created and a disconnect from the dbms occurs. At this point, the
table, #tmp, is gone.
Hot fixes for Release 8.2 are available.
V8.2 SAS/ACCESS to ODBC :
A Technical Support hot fix for this problem is available at:
http://www.sas.com/techsup/download/hotfix/82_sbcs_prod_list.html#82od02
Operating System and Release Information
SAS System | SAS/ACCESS Interface to ODBC | Microsoft Windows 2000 Professional | 8 TS M0 | 8.2 TS2M0 |
Microsoft Windows 2000 Server | 8 TS M0 | 8.2 TS2M0 |
Microsoft Windows XP Professional | 8.2 TS2M0 | 8.2 TS2M0 |
Microsoft Windows NT Workstation | 8 TS M0 | 8.2 TS2M0 |
Microsoft Windows 95/98 | 8 TS M0 | 8.2 TS2M0 |
Windows Millennium Edition (Me) | 8.2 TS2M0 | 8.2 TS2M0 |
Microsoft Windows 2000 Advanced Server | 8 TS M0 | 8.2 TS2M0 |
Microsoft Windows 2000 Datacenter Server | 8 TS M0 | 8.2 TS2M0 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Type: | Problem Note |
Priority: | |
Topic: | SAS Reference ==> LIBNAME Engines Third Party ==> Information Exchange ==> ODBC (Open Database Connectivity)
|
Date Modified: | 2004-02-20 14:21:42 |
Date Created: | 2002-05-06 12:36:21 |