在数据库表中插入字段,插入之前会判断该字段是否存在
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