closetome

alter table yourtable add constaints ConstaintName primarykey(columnNmae)

or

create table yourtable(column1 int primary key,....)

--增加列
alter table [TableName] add [P_ID] bigint not null default 0
--删除列
alter table [TableName] drop column [P_ID]
--设置主键
alter table [TableName] add constraint PK_TableName primary key (P_ID)
--删除主键
alter table [TableName] drop constraint PK_TableName
--创建聚集索引(一个表中允许一个聚集索引)
CREATE CLUSTERED INDEX [tTopIndex] ON [TableName] ([P_ID]) ON [PRIMARY]
--创建非聚集索引
CREATE INDEX [tTopIndex] ON TableName ([P_ID]) ON [PRIMARY]
--删除索引
drop index [TableName].[tTopIndex]
--增加字段说明
EXECUTE sp_addextendedproperty N\'MS_Description\', N\'照片ID\', N\'user\', N\'dbo\', N\'table\', N\'TableName\', N\'column\', N\'P_ID\'

分类:

技术点:

相关文章:

  • 2021-12-05
  • 2021-11-01
  • 2021-10-18
  • 2021-08-13
  • 2021-12-10
  • 2021-11-30
猜你喜欢
  • 2021-10-18
  • 2021-10-18
  • 2021-10-18
  • 2021-10-18
  • 2021-10-18
  • 2021-12-01
  • 2021-10-22
相关资源
相似解决方案