我正在尝试使用此脚本将生成列添加到现有表:
alter table Asset_Store add column
md5_hash VARCHAR(100) GENERATED ALWAYS AS
(CAST(UPPER(
case
when OR_ID is not null then MD5(cast(OR_ID as varchar(100)))
when Asset_ID is not null then MD5(Asset_ID)
else null
end
) as VARCHAR(100)))
STORED
;
但是我遇到了一个错误:
SQL Error [42601]: ERROR: syntax error at or near "("
Position: 88
ERROR: syntax error at or near "("
Position: 88
ERROR: syntax error at or near "("
Position: 88
问题是什么?我不明白。
在我的 Asset_Store 表模式中,OR_ID 列是 int 类型,Asset_ID 列是 varchar(100) 类型。
我猜它期望的语法略有不同……但正确的语法是什么?
select version();
会给你什么结果? - user330315