第一次使用SQL Pass-Through并且无法弄清楚它是如何工作的。
libname myl odbc datasrc=AAA;
我试过这个
proc contents data=myl.mytable;run;
它与
完全相同proc contents data=AAA.mytable;run;
那么libname
语句有效吗?
但是当我试着这个没有运气时。
proc sql;
connect to ODBC(datasrc=AAA);
execute (delete from Oit.d1 where datepart(Date) >= '08Mar2014'd) by ODBC;
disconnect from ODBC;
quit;
错误显示
ERROR: CLI error trying to establish connection: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
我是否错过了一些论点?
答案 0 :(得分:1)
您可以查看以下内容:
datasrc=
语句中的拼写错误或未能在Control Panel->ODBC Data Sources
中设置DSN引起的。 AAA
)与Control Panel->ODBC Data Sources
中的名称完全相同。 System DSN
而不是User DSN
。系统DSN对计算机上的所有用户都可见,而不仅仅是创建该ODBC连接的用户。这是我的ODBC直通语句通常查找简单查询的方式:
/* mySQL example */
proc sql noprint;
connect to odbc (datasrc=myDSN user=myusername password="mypassword");
create table sqlo as
select *
from connection to odbc
(
select * from database.table limit 1
)
;
quit;