USE AMS_3 --跳转到指定的数据库 --判断 AmsWorkBill_WoInfo 表中是否已存在字段(TargetOwnerCode) if(Not Exists(Select * from Sys.Columns c inner join Sys.Objects o on c.Object_Id=o.Object_Id where c.Name='TargetOwnerCode' and o.Name='AmsWorkBill_WoInfo')) begin Alter Table AmsWorkBill_WoInfo Add TargetOwnerCode nvarchar(500)--添加字段 end GO