如何在 SAP ASE Sybase 16 中更新记录?

若昂·佩雷拉

我实际上是按照 UPSERT 上的 SAP 文档第一个示例在 ASE 中记录的:https ://help.sap.com/viewer/cbed2190ee2d4486b0bbe0e75bf4b636/16.0.3.2/en-US/faf583d9adc547ad8a164bb3f41ea6cd.html

1> select @@version
2> go
Adaptive Server Enterprise/16.0 SP03 PL06/EBF 28334 SMP/P/x86_64/SLES 11.1/ase1
60sp03pl06x/3457/64-bit/FBO/Mon Nov 26 04:33:30 2018
(1 row affected)

1> select * from t1
2> go
 a           b           c
 ----------- ----------- -----------
           1           2           3
(1 row affected)

1> upsert t1(a,b,c) values(1,2,3)
2> go
Msg 102, Level 15, State 181:
Server 'NPL', Line 1:
Incorrect syntax near 'a'.

有谁知道为什么我在 UPSERT 语句中收到此“语法错误”错误?谢谢

标记融合

要在 ASE 中使用(受限版本)HANA SQLScript,您首先需要创建一个支持SQLScript解析器的数据库(请参阅创建 SQLScript 数据库),例如:

use master
go
create database sqlscript_db
    on data_01=10
log on log_01=5
for sqlscript                  -- enable use of SQLScript parser
go

运行sp_helpdb(从非 SQLScript 数据库)以验证数据库状态:

use master
go
sp_helpdb sqlscript_db
go

 name         db_size       owner dbid created      durability lobcomplvl inrowlen status
 ------------ ------------- ----- ---- ------------ ---------- ---------- -------- ---------
 sqlscript_db       15.0 MB sa       7 Mar 25, 2022 full                0     NULL sqlscript
... snip ...                                                                       ^^^^^^^^^

您现在应该能够upsert在这个新数据库中使用该语句:

use sqlscript_db
go
create table t1 (a int, b int, c int)
go
upsert t1(a,b,c) values(1,2,3)
go
(1 row affected)

select * from t1
go

 a           b           c
 ----------- ----------- -----------
           1           2           3

注意:已验证ASE 16.0 SP04 GA


验证SQLScript/upsert在非 SQLScript 数据库中不起作用:

use tempdb
go
create table t1 (a int, b int, c int)
go
upsert t1(a,b,c) values(1,1,1)
go

Msg 102, Level 15, State 181:
Server 'ASE400', Line 1:
Incorrect syntax near 'a'.

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在 Sybase ASE 16.0 中查找触发器状态(启用或禁用)?

ASE SYBASE/SQL SERVER 中的簇索引

什么是 Sybase ASE 中以“N”结尾的类型?

如何查找触发器以及在 Sybase ASE 16.0 中的表上定义的模式?

Sybase(SAP)ASE ADO.NET连接因Blob插入而超时

更改表中的列以在Sybase ASE 16.0中自动递增

将sybase ASE中的结果限制在特定范围内

在 SYBASE ASE 12.5 中获取系统过程的 ROWCOUNT

如何一次在所有数据库中添加用户?(Sybase-ASE)

Sybase ASE 16x和.NET Core 1.1进行SP调用

SAP ASE数据库中的分区修剪/消除

Sybase ASE:如何使用光标打印所有表行?

在Sybase ASE(或Sed)中的bcp输出文件中格式化datetime字段

可以在 Sybase ASE 的非链式事务中实现链式事务吗?

查询以sybase ase输出文件

JDBC 检索外键列名(sybase ase)

Sybase ASE按等效级别连接

用于 PHP7 的 ASE Sybase 模块

Python 3.4-Sybase ASE连接

为Sybase ASE创建systemd脚本

ASE 15.0.3中的缓存过程如何工作

如何创建同时服务于 Redis 缓存(NoSQL)和 Sybase ASE(关系数据库)的单个 Java 域类?

Sybase ASE / SQL Server中可用的带有RECOMPILE的CREATE PROCEDURE <Proc1>的等效oracle代码是什么?

SAP Sybase WHILE 在 FOR LOOP 内部

Sybase IQ中16 - 谁改变了产品查找会员

无法连接到服务器上的 Sybase ASE 16.0

Sybase ASE 15.7 CTE到子查询的问题

Sybase ASE:优化具有多个子查询的查询

字符串的Sybase ASE 15聚合函数