将查询传递给SQL Server时遇到了一些麻烦。操作系统是RedHat 6.在SAS Enterprise Guide中,我尝试执行此代码:
LIBNAME CISCO SQLSVR DBLIBINIT='SET ANSI_NULLS, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING ON' Datasrc="nikolaev.ivan.ru" SCHEMA=cc USER=vorob2 PASSWORD="{SAS002}9930904131DC199B130A9E7D42A49B5D" ;
proc sql;
insert into CISCO.vContact_I (FirstName, MidName, LastName, Address, Phone, MobilePhone, EMail, ClientCode, AddInfo, Sex, TOPIC_ID, CUSTOMER_RK, RESPONSE_TRACK_CD, QuestFlag, CriticalMessage, RegularMessage)
values ('N/A','AO Lomon', 'Воронин Саша', 'N/A/N/A/N/A мес/платеж N/A','N/A', 'N/A','N/A','01039602','',1,.,'01039602','26670201',0,'N/A','N/A');
quit;
但我遇到了错误:
错误:CLI执行错误:[SAS] [ODBC SQL Server有线协议驱动程序] [Microsoft SQL Server] INSERT失败,因为以下SET 选项设置不正确:' QUOTED_IDENTIFIER'。验证SET选项是否正确用于索引视图和/或 计算列和/或过滤索引和/或查询通知和/或XML数据类型方法和/或空间的索引 索引操作。 :[SAS] [ODBC SQL Server有线协议驱动程序] [Microsoft SQL Server]语句无法准备。
如果我尝试将QUOTED_IDENTIFIER
选项放入execute
语句,它可以正常运行:
proc sql;
connect to sqlsvr as sql
(Datasrc="nikolaev.ivan.ru" USER=vorob2 PASSWORD="{SAS002}9930914010DC199B130A9E7D42A49B5D");
execute(
SET QUOTED_IDENTIFIER ON;
insert into cc.vContact_I (FirstName, MidName, LastName, Address, Phone, MobilePhone, EMail, ClientCode, AddInfo, Sex, TOPIC_ID, CUSTOMER_RK, RESPONSE_TRACK_CD, QuestFlag, CriticalMessage, RegularMessage)
values ('N/A','AO Lomon', 'Воронин Саша', 'N/A/N/A/N/A мес/платеж N/A','N/A', 'N/A','N/A','01039602','',1,'','01039602','26670201',0,'N/A','N/A');
) by sql;
是否有机会使用SQLSVR将QUOTED_IDENTIFIER
放入LIBNAME STATEMENT
?
ODBC和OLEDB的SAS / ACCESS组件未获得许可。
答案 0 :(得分:1)
@Jdzel 你使用什么类型的连接? 尝试添加参数CONNECTION = SHAREDREAD。 Libname stetement将如下:
LIBNAME CISCO SQLSVR DBLIBINIT ='SET ANSI_NULLS,QUOTED_IDENTIFIER,CONCAT_NULL_YIELDS_NULL,ANSI_WARNINGS,ANSI_PADDING ON'CONNECTION = SHAREDREAD Datasrc =“nikolaev.ivan.ru”SCHEMA = cc USER = vorob2 PASSWORD =“{SAS002} 9930904131DC199B130A9E7D42A49B5D”;