for example:
create table tbl
( [id] int identity(1,1) not null,
a varchar(10))
create table tbl
( [id] int identity(1,1) not null,
a varchar(10))
解决方案 »
- sq1 server简单的初级题目!(100分)!求答案!(100分)
- 如何优化select col1,col2.... from table 的速度
- 急问:在做sum取和的时候如何去掉重复值?
- 紧急求助!!!
- 我SQL2005连接不上,之前还连接上了的,帮忙解答下,谢谢!
- 批量提取更新别名
- 最后的40分,这个库怎么建,不要给我建库代码,教我在企业管理器建
- 求救!!!!!!!!!!!!!!
- 关于查询分析器用SQL Server身份验证问题,着急
- nononono(null,null):VFP报表中,设置数据分组以后,怎么按照分组表达式求计算字段?把结果放到组标头
- FILLFACTOR 根据什么而设置最合适
- 兄弟们,一个很难的问题,是关于sql server的日期问题!
是利用函数
先创建函数
create function getfun()
returns int
as
begin
declare @n int
select @n=isnull(max(id),0)+1 from ai
return @n
end
create table ai (id int primary key default(dbo.getfun()),ii int)
alter table xu002
drop column a
goalter table xu002
add a int identity(1,1) primary key
drop column a
go
alter table xu002
add a int identity(1,1) not null,
alter table xu002
add constraint pk_a primary key(a)
ALTER TABLE 表 ADD 编号1 bigint identity(1,1) not null
go
SET IDENTITY_INSERT 表 ON
go
update 表 set 编号1=编号
go
SET IDENTITY_INSERT 表 OFF
go
ALTER TABLE 表 DROP COLUMN 编号
go
exec sp_rename '表.编号1','编号'
go
create table tbl
( [id] int identity(1,1) not null,
a varchar(10))
或者在企业管理里面设计表标识下选是