常用SQL语句

1.创建唯一索引

create unique index activityConfigDetail_ConfigIdPageLocation
on activityConfigDetail(ConfigId,PageLocation)

2.创建普通索引

create  index activityConfigDetail_ConfigIdPageLocation
on activityConfigDetail(ConfigId,PageLocation)

 

3.更改列的类型

alter table [dbo].[ActivityConfigInfo]
alter column [DayPrjMin] int null

 

4.删除约束

alter table [dbo].[ActivityConfigInfo]
drop constraint DF__ActivityC__DayPr__7325FEFD

 

5.添加字段

alter table [dbo].[ActivityConfigInfo]
add [DayPrjMin] int null

 

6.删除字段

if exists(select * from syscolumns where id=object_id('Table1') and name='Field1')
begin
alter table Table1
drop column Field1
end

Go

posted @ 2016-06-16 17:30  zslm___  阅读(153)  评论(0编辑  收藏  举报