将主表主键设置为ID,另外将子表主键设置为AID,子表的外键ID和主表一样。那么当发生对主表记录进行删除操作,可以方便的对关联的子表数据一并删除!
declare @selectStr nvarchar(1000)set @selectStr='delete from Bdrdrecord11 ' + @searchString+' delete from Bdrdrecords11 '+@searchStringexec (@selectStr)
本文共 226 字,大约阅读时间需要 1 分钟。
将主表主键设置为ID,另外将子表主键设置为AID,子表的外键ID和主表一样。那么当发生对主表记录进行删除操作,可以方便的对关联的子表数据一并删除!
declare @selectStr nvarchar(1000)set @selectStr='delete from Bdrdrecord11 ' + @searchString+' delete from Bdrdrecords11 '+@searchStringexec (@selectStr)
转载地址:http://usddm.baihongyu.com/