sqlserver 判断当前数据是否存在 不存在则插入

来源:互联网 发布:博购软件 编辑:程序博客网 时间:2024/04/28 14:05

insert into product_agent(productId,agentId)
select top 1 'A41789B1-4CA3-48CC-82A4-2F5BCE23D424','9BAC02BD-F551-4105-95D6-E70008C5C919' from product_agent
where (select count(1) from product_agent where productId='A41789B1-4CA3-48CC-82A4-2F5BCE23D424' and agentId='9BAC02BD-F551-4105-95D6-E70008C5C919')<1

0 0
原创粉丝点击