在数据库表中插入字段,插入之前会判断该字段是否存在

declare @tableId int
set @tableId = object_id('Atmonthd')
 
 if not exists (
    select * from  syscolumns
    where id = @tableId
    and name = 'OTShift_Hours'
)
begin  
    alter table Atmonthd
    add OTShift_Hours float
end
posted @ 2012-10-15 12:06  kdkler  阅读(482)  评论(0编辑  收藏  举报
我的博客   我的时间线   自定义科技