楼主: playmore
2678 4

[问答] 请问如何更新利用OLEDB连接的SAS表格 [推广有奖]

已卖:1645份资源

学科带头人

2%

还不是VIP/贵宾

-

TA的文库  其他...

R相关

经济学相关

金融工程

威望
1
论坛币
16356 个
通用积分
8.6697
学术水平
372 点
热心指数
394 点
信用等级
341 点
经验
15297 点
帖子
1194
精华
1
在线时间
1332 小时
注册时间
2007-1-11
最后登录
2025-12-1

初级学术勋章 初级热心勋章 中级热心勋章

楼主
playmore 发表于 2013-7-16 14:21:01 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我有一个逻辑库是用libname的OLEDB方法连接的服务器上的数据库
我想定期利用在SAS里计算得到的表格更新该逻辑库里的表

我知道可以用data步里的update,发现这只能应用于SAS自创的逻辑库中的表,比如

data source;
input key $ value;
datalines;
a 13
b 23
c 83
;
run;

data new;
input key $ value;
datalines;
c 56
d 13
e 87
;
run;

proc sql noprint;
    update source
        set new;
quit;

上述代码在SAS中是可以运行的
但如果把Source表放在保存在服务器上的那个逻辑库里,则无法运行,出如下的错误
ERROR: The OLEDB table source has been opened for OUTPUT. This table already exists, or
there is a name conflict with an existing object. This table will not be replaced. This
engine does not support the REPLACE option.

我在网上查了下,在下面的文章里大概明白了点
support.sas.com/resources/papers/proceedings09/141-2009.pdf‎
里面提到的方法就是删了旧表,再复制新表
只不过我的Source表是个大表,定期更新一条数据而已,我觉得这样会很耽误时间
不知道有其他好办法没有,谢谢!


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:OLED OLE LED EDB Proceedings 如何

本帖被以下文库推荐

playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

沙发
邓贵大 发表于 2013-7-16 21:21:36
(1) upload dataset new into database as a temporary table
(2) issue a pass-through query to update the DB table.
Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

藤椅
playmore 发表于 2013-7-18 08:49:09
邓贵大 发表于 2013-7-16 21:21
(1) upload dataset new into database as a temporary table
(2) issue a pass-through query to update  ...
大侠能把第2条展开说下吗?
没看明白
谢谢
playmore邀请您访问ChinaTeX论坛!!!进入ChinaTeX论坛

板凳
邓贵大 发表于 2013-7-18 20:54:35
in case of SQL Server,
  1. libname sqlsrv init_string="***" connection=shared insertbuff=2000;
  2. data sqlsrv.'##new'n;
  3.     set new;
  4. run;
  5. proc sql;
  6. connect to oledb(init_string="***");
  7. execute(
  8.      update source a set a.value = b.value
  9.      from source inner join ##new b on a.key=b.key
  10. ) by oledb;
  11. disconnect from oledb;
  12. quit;
复制代码
Other DBMSs are similar.
In case of MS Access, you can use regular tables instead of temporary tables because you own the database exclusively. And the update statement will be like
  1. update source inner join new on source.key=new.key
  2. set source.value = new.value
复制代码
已有 2 人评分学术水平 热心指数 信用等级 收起 理由
zhou.wen + 1 + 1 + 1 邓大侠总是能让人耳目一新
playmore + 1 + 1 + 1 精彩帖子

总评分: 学术水平 + 2  热心指数 + 2  信用等级 + 2   查看全部评分

Be still, my soul: the hour is hastening on
When we shall be forever with the Lord.
When disappointment, grief and fear are gone,
Sorrow forgot, love's purest joys restored.

报纸
加油吧陈同峰 发表于 2013-7-26 14:12:59
学习

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-7 12:00