我想在表格中添加列。如果我的脚本的那部分执行,我还想向表中添加一些值。我该怎么做 ?
if not exists (select 1 from sys.columns
where object_id = object_id('CAT_MASSUPDATETASKPARAM')
and name = 'ValueBoolean' )
begin
alter table CAT_MASSUPDATETASKPARAM add ValueBoolean bit NULL
end
go
IF (the first script was running do this script )
INSERT INTO CAT_MASSUPDATETASKPARAM ( ParentTaskIK,
ParamType,ParamName,ValueInt,ValueStr,ValueBoolean)
SELECT ParentTaskIK, 'Boolean','SHOW_CURRENT',NULL,NULL,1
FROM CAT_MASSUPDATETASKPARAM ,CAT_MASSUPDATETASK
WHERE CAT_MASSUPDATETASKPARAM.ParentTaskIK = CAT_MASSUPDATETASK.Id
AND CAT_MASSUPDATETASK.MassUpdateType in ('somthing','somthing1')
GROUP BY ParentTaskIK
go