[英]GENERATED ALWAYS AS at MariaDB
I have already used GENERATED ALWAYS AS
when creating new tables.创建新表时,我已经使用GENERATED ALWAYS AS
。 However, when I try to UPDATE TABLE
an already existing table with this computed/generated column I keep on getting a 1064 error.但是,当我尝试使用此计算/生成的列UPDATE TABLE
时,我不断收到 1064 错误。 I have also tried with the ALTER TABLE
option, but haven`t had any success either.我也尝试过使用ALTER TABLE
选项,但也没有任何成功。
Sample:样本:
UPDATE TABLE crecimiento_pib
SET País GENERATED ALWAYS AS (CONCAT(CountryName,' ',CountryCode));
Thanks for the help you can provide!感谢您提供的帮助!
If you are trying to add a computed column to an existing table, the syntax is:如果您尝试将计算列添加到现有表,则语法为:
ALTER TABLE crecimiento_pib
ADD COLUMN País varchar(200) GENERATED ALWAYS AS (CONCAT(CountryName, ' ', CountryCode));
with an appropriate size defined by the length of the CountryName
and CountryCode
columns (which you haven't shown).具有由CountryName
和CountryCode
列的长度定义的适当大小(您尚未显示)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.