22,209
社区成员
发帖
与我相关
我的任务
分享
BEGIN
if exists (select IntervalID from IntervalInfo where IntervalName=@IntervalName and StationID=@StationID )
begin --存在
-- 写你的插入语句
end
else --不存在
begin
--不存在
end
END
-- 大概这样的一个语法
insert into t (col1,col2...)
select .... from x
where exists(select .... from y where x.id = y.id )