SQL删除一个表时把另外一个相关的表删除

来源:百度知道 编辑:UC知道 时间:2024/08/21 02:51:58
如有2张表A,B,A中有字段aa,B中有字段bb, aa,bb所表达的意思是一样的
delete * from A,B where ...............
我要把它放到String sql="代码";
最好能一句完成

你那样写是不对的.。存在语法错误!

你要上除两个表,你就这样Sqlserver代码写吧?
--删除表A;
if exists(select * from sysobjects where name='A')
drop table A
go

--删除表B;
if exists(select * from sysobjects where name='B')
drop table B
go

使用事务·