在 Sybase ASE 中删除列 table
Drop columns in Sybase ASE table
如何在 Sybase ASE 15 table 设置中删除列。
我试了几次,没用:
alter table my_table
drop column1, column2
以及查看 Sybase documentation 没有解决我的问题。
The 'select into' database option is not enabled for database
'my_db'. ALTER TABLE with data copy cannot be done. Set the 'select
into' database option and re-run.
您忘记在查询中使用关键字 'COLUMN'。使用以下语法:-
ALTER TABLE my_table
DROP COLUMN column1, column2
由于您在数据库上的 select into
选项已关闭,因此有两个选项可以使用
打开 select into
选项
sp_dboption my_db, "select into", true
或
alter table drop column 的 no datacopy
参数允许您从 table 中删除列而不执行数据复制,并减少 alter table 将列拖放到 运行.
SYBASE Documentation - Dropping Columns from a Table Without Performing a Data Copy
ALTER TABLE my_table
DROP column1, column2
WITH no datacopy
我找到了解决方案。我的新测试数据库关闭了 'select into' 选项,这意味着 removal/alterations 个表被拒绝。
即
sp_dboption my_db, "select into", true
既然我知道选项是什么,一切看起来都很明显。
有趣的是,必须打开 "select into" 这一事实意味着 Sybase 服务器正在内部将数据从旧的 table 复制到 table 的新副本,不使用事务日志(或仅使用事务日志来记录页面分配,而不是页面内的数据更改)。 IE。有点像批量复制。我想知道这是否会导致复制问题?
此外,为了完整起见,"no datacopy" 功能是从版本 15.7.1 开始的新功能。
只想与您分享我刚刚遇到了类似的问题,在我的情况下,我必须在每个列名称之前添加 "drop"。代码如下所示:
alter table dba.ABC
drop column1,
drop column2,
drop column3
commit;
我使用的是一些不太灵活的旧版本的 sybase。
干杯
如何在 Sybase ASE 15 table 设置中删除列。
我试了几次,没用:
alter table my_table
drop column1, column2
以及查看 Sybase documentation 没有解决我的问题。
The 'select into' database option is not enabled for database 'my_db'. ALTER TABLE with data copy cannot be done. Set the 'select into' database option and re-run.
您忘记在查询中使用关键字 'COLUMN'。使用以下语法:-
ALTER TABLE my_table
DROP COLUMN column1, column2
由于您在数据库上的 select into
选项已关闭,因此有两个选项可以使用
select into
选项
sp_dboption my_db, "select into", true
或
alter table drop column 的 no datacopy
参数允许您从 table 中删除列而不执行数据复制,并减少 alter table 将列拖放到 运行.
SYBASE Documentation - Dropping Columns from a Table Without Performing a Data Copy
ALTER TABLE my_table
DROP column1, column2
WITH no datacopy
我找到了解决方案。我的新测试数据库关闭了 'select into' 选项,这意味着 removal/alterations 个表被拒绝。
即
sp_dboption my_db, "select into", true
既然我知道选项是什么,一切看起来都很明显。
有趣的是,必须打开 "select into" 这一事实意味着 Sybase 服务器正在内部将数据从旧的 table 复制到 table 的新副本,不使用事务日志(或仅使用事务日志来记录页面分配,而不是页面内的数据更改)。 IE。有点像批量复制。我想知道这是否会导致复制问题?
此外,为了完整起见,"no datacopy" 功能是从版本 15.7.1 开始的新功能。
只想与您分享我刚刚遇到了类似的问题,在我的情况下,我必须在每个列名称之前添加 "drop"。代码如下所示:
alter table dba.ABC
drop column1,
drop column2,
drop column3
commit;
我使用的是一些不太灵活的旧版本的 sybase。 干杯