select (select count(*) from tablename where id<=A.id) as id,field1,field2....... from tablename A
解决方案 »
- 不能将值 NULL 插入列
- VB/VC+sql编程后,现要将数据库里的表名,字段名更改,咋办:(
- 急,真的很急!!!update一条语句,执行结果完成拉,但数据居然没有修改,什么原因啊
- 那个高手帮我看看这个存储过程
- 字符串的查找!!!急急急
- 请教高手,将两个时间字段的差乘以数字记到第三个字段“计费”中,如何写SQL?
- 如何获取记录值?
- vfp问题??(关于VFP与EXCEL关联问题)
- 多用户操作同一个表的问题,并且多个用户怎么管理(如建用户管理和密码时怎么建表)?能不能举个例子!
- 请大虾指点,关于sql server数据库的访问问题,急!!!
- 很急!!!为何在安装SQL Server 2000的启动服务器时,机器长时间没响应?
- 请问,如何在往表中插入新纪录的同时,把实时的时间添加到表中的datetime字段
你的意思是select出来以后是1/2/3/4,还是在数据库中update成1/2/3/4?如果是前一种看看j9988(j9988)的,如过是后一种,你估计要加触发器来实现了。
谢谢,是在数据库中把序号修改成1/2/3/4!不知道改如何做呢?谢谢!
on table_main
for update
as
update table_mx
set type=i.type,shul=i.shul
from inserted i,deleted d,table_mx x
where i.bianh=d.bianh
and d.type=x.type
and d.shul=x.shulgo
@i int
select @i = 1declare update_id cursor scroll_locks
for select id from tablename where condition
for update of idfetch next from update_id into @ll_id
while (@@fetch_status <> -1)
begin
update tablename set id = @i where current of update_id
fetch next from update_id into @ll_id
select @i = @i + 1
end
deallocate update_id