将行号添加到新列 [英] Add Row number to a new column

查看:219
本文介绍了将行号添加到新列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个新列,并用行号填充该列中每一行的值.

I want to create a new column and populate the value of each row in that column with the row number.

这可以在oracle中通过执行此操作来实现.

This could be achieved in oracle by doing this.

alter table mytable add (myfield integer);
update mytable set myfield = rownum;

这将在SYBASE ASE中完成吗?

How would this be done in SYBASE ASE?

推荐答案

alter table mytable 
add id bigint identity not null

仅此而已.每行中都有一列id,其中包含该行的唯一序列号.

That's all. There will be a column id in every row that contains a unique sequence number for that row.

这篇关于将行号添加到新列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆