常用的sql语句

删除索引

drop index [User_Publish_ischeck] ON [dbo].[User_Publish]

 

删除主键

alter table User_Publish  drop constraint PK_User_Publish

 

创建索引
CREATE NONCLUSTERED INDEX [User_Publish_ischeck] ON [dbo].[User_Publish]
(
    [IsCheck] ASC
)

 

--创建非聚集索引

create nonclustered index inx_entry_stock_on entry_stock_d(entry_stock_bi)

 

--主键且非聚集
alter table entry_stock_d add primary key nonclustered--主键且非聚集
(
 entry_stock_bi,aid

}

 

创建唯一非聚集索引

CREATE UNIQUE INDEX AK_UnitMeasure_Name 
ON Production.UnitMeasure(Name);
GO

创建分区聚集索引

create clustered index PK_User_Publish_RefTime
on User_Publish(RefTime)
on RefTimePS(RefTime);

 

删除约束
alter table [User_Publish] drop constraint DF_User_Publish_IsCheck

 

增加约束
ALTER TABLE User_Publish
ADD CONSTRAINT DF_User_Publish_IsCheck DEFAULT (0)  FOR IsCheck

 

修改列的类型
ALTER TABLE User_Publish ALTER column IsCheck char(1) null

posted @ 2010-11-04 16:04  虎头  阅读(197)  评论(0编辑  收藏  举报