建议你写个存储过程,我写的一个,让你参考一下!CardNo是自定义的数据类型!用触发器容易出错
CREATE PROCEDURE DelFixUser
@CardNo CardNo
AS
Declare @CarNo CarNo
select @CarNo=车辆号码 from FixCardIndexTable
where 卡号=@CardNo
Delete from AllCardIndexTable
where 卡号辩租=@CardNo
Delete from FixCardIndexTable
where 卡慎明号=@CardNo
Delete from FixCardEndDateTable
where 卡号=@CardNo
Delete from CardPassWordTable
where 卡号携孝兆=@CardNo
Delete from UserCarInfoTable
where 车辆牌号=@CarNo
说明:删除一个固定用户记录,同时从AllCardIndexTable、FixCardIndexTable、FixCardEndDateTable、CardPassWordTable和UserCarInfoTable表中删除相应的记录。
这里还不如老老态源实实的写,你看有没有必要写存储过程
set rs=server.createobject("adodb.recordset")
sql="select A.employeeID as ID from A,B,C where A.employeeID=B.employeeID and B.employeeID=C.employeeID and employeeID=1"
rs.open sql,conn,1,1
if not rs.eof then
ID=rs("ID")
conn.execute "delete from A where employeeID="& ID顷埋
conn.execute "delete from B where employeeID="& ID帆乎态
conn.execute "delete from C where employeeID="& ID
end if
用一芦耐消个sql是不可能的了 自己写陪知一个函数 或者 先循环A的亩改记录集 删除B,C
最后删除A的
建议写个触发器,比如删除A中内容同时删除B,C中内容