篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Borrar docs por base de datos相关的知识,希望对你有一定的参考价值。
declare @FRM_ID varchar(20)
declare @FLD_ID varchar(20)
declare @QUERY varchar(1000)
SET @FRM_ID = 355;
SET @FLD_ID = 5115;
--Permisos de lecutra
delete from SYS_READERS where DOC_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
--Properties
delete from SYS_PROPERTIES where SYS_PROPERTIES.OBJ_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
--Permisos
delete from SYS_ACC_DOC where DOC_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
--Adjuntos
delete from SYS_ATTACHMENTS where DOC_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
--Eventos Asincrnos trigger
delete from SYS_EVN_QUEUE where DOC_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
-- LOGS
delete from SYS_DOC_LOG where DOC_ID in (select doc_id from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID);
-- SYS_DOCUMENTS
--Execute
SET @QUERY = 'delete from SYS_FIELDS_' + @FRM_ID + ' WHERE DOC_ID IN (select doc_id from SYS_DOCUMENTS where FLD_ID ='+@FLD_ID+' and FRM_ID ='+ @FRM_ID+ ')';
Print @QUERY;
Exec (@QUERY)
delete from SYS_DOCUMENTS where FLD_ID = @FLD_ID and FRM_ID = @FRM_ID;
以上是关于sql Borrar docs por base de datos的主要内容,如果未能解决你的问题,请参考以下文章