(特殊的)增删改查

插入数据

declare @vid int
select @vid=max(id)+1 from Table_1
insert into Table_1
select @vid,b.name
from Table_1  a inner join Table_2 b on  a.id=b.id
where b.id=1 and b.name='加下划线为阿斯达司法所'

另一种删除数据的方法(MSDN上没有)

insert into Table_1 values(1,'加下划线为')
insert into Table_2 values(1,'加下划线为阿斯达司法所')
表关联删除
select * from Table_1

select * from Table_2

delete a  from Table_2 a inner join Table_1 b on  a.id=b.id where b.id=1 and b.name='加下划线为'

posted on 2013-05-07 18:05  为学日损  阅读(133)  评论(0编辑  收藏  举报

导航