如果不存在主键(或是有唯一约束的列)(keycol)那就不会了
create view v as
select sn=(select sum(1) from test where keycol<=a.keycol),* from test a
create view v as
select sn=(select sum(1) from test where keycol<=a.keycol),* from test a
create view v as
select sn=(select sum(keycol+1) from test where keycol<=a.keycol),* from test a
select sum(1) from sysobjects --sysobjects共有84行/*结果如下
-----------
84 (所影响的行数为 1 行)
*/
CREATE VIEW dbo.v
AS
SELECT id, a, b,
'a' as myfield
FROM dbo.test
只要把myfield字段实现自动编号,而且增加值为1就可以了
谢谢!