简单的语句 插入数据时对某字段的值进行判断,如果有重复就不能插入. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @id as intset @id = ...if not exists(select 1 from tb where id = @id) insert into tb(id) values(@id) insert into ta(id,name,name2)select id,name,name2 from tb twhere not exists(select * from ta where id=t.id) SQL树结构 汇总(有点小难度) 在access数据库中 能不能添加约束 数据库远程备份的奇怪问题 SQL是否可以分段读取记录 请教一SQL跨表查询 触发器嵌套问题 请教一下关于sqlserver里的几个数据类型 有懂NOVELL的吗??请问在NOVELL中提示这个问题应该怎么解决?大家帮下忙,CSDN中好象没有NOVELL专区啊! 等救~~~~~~~~~~大家帮忙呀~~~~~~SQL2000安装问题 数据库同步问题(内外网,不能直接连通) 连接 2个表的查询语句如何写? 求助!表内数据复制问题。
set @id = ...if not exists(select 1 from tb where id = @id)
insert into tb(id) values(@id)
select id,name,name2 from tb t
where not exists(
select * from ta where id=t.id
)