Update
dbo.PartOpr
Set
字段=值
-- 存在記錄才更新
Where
OperationDesc=@OperationDesc
and
TopVersion=@TopVersion
and
DrawNum=@DrawNum
and
TopPartNum=@TopPartNum
and
[Version]=@Version
Insert
into
dbo.PartOpr(字段)
Select
字段
-- 不存在記錄才插入
Where
Not
exists(
select
1
from
dbo.PartOpr
Where
OperationDesc=@OperationDesc
and
TopVersion=@TopVersion
and
DrawNum=@DrawNum
and
TopPartNum=@TopPartNum
and
[Version]=@Version
)