create table test
(
Aid int not null identity(1,1),
id as 'table_'+cast(Aid as varchar(10)),
acyear varchar(50) not null
)我想把id这列设成主键
有什么办法吗?
(
Aid int not null identity(1,1),
id as 'table_'+cast(Aid as varchar(10)),
acyear varchar(50) not null
)我想把id这列设成主键
有什么办法吗?
(
Aid int not null identity(1,1) primary key,
id as 'table_'+cast(Aid as varchar(10)),
acyear varchar(50) not null
)
create table test
(
Aid int not null identity(1,1) ,
id as isnull('table_'+cast(Aid as varchar(10)),'') primary key,
acyear varchar(50) not null
)
如果可以为空的话,就不能添加为主键,因为主键要求的那个字段不能为空。。(*^__^*) 嘻嘻……不知道对不对。。