sql语句问题 如何将字段添加到第一行

来源:百度知道 编辑:UC知道 时间:2024/05/29 11:59:29
alter table 表名 add 字段 类型

这样添加到最后面 我想添加到最前面 能实现吗

(往表里第一个位子添加 自动编号字段 sqlserver 2000 谢谢)

一个简单的方法..

select cou1,cou2 into #tb1 from tablename

drop table tablename

create table tablename(id int identity(1,1),cou1 int,cou2 int)

insert into tablename(cou1,cou2)
select cou1,cou2 from #tb1

这样就OK了..
id identity(1,1) 这个不知道对写了没,不太记得了

如果是自动编号..那

数据库字段的位置是没有意义的,你要做这个干什么啊。
你可以使用select语句随意调整列的查询顺序

说的什么东西?
这年头连提问都不认真

说的什么东西?
这年头连提问都不认真

不明白你在说什么