Vider une boîte de messages

De Wiki1000
(Différences entre les versions)
Ligne 10 : Ligne 10 :
 
and ((t0.ReceivedFrom = 'chfou') and (t0.DateCreate < Convert(DateTime,'2008-01-01 00:00:00',120)))
 
and ((t0.ReceivedFrom = 'chfou') and (t0.DateCreate < Convert(DateTime,'2008-01-01 00:00:00',120)))
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:37.43 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
insert into dbo.sysGlbTemp
 
insert into dbo.sysGlbTemp
 
select '000000000000000000870000811E0004',oid from dbo.TDMFDOCUMENT where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
 
select '000000000000000000870000811E0004',oid from dbo.TDMFDOCUMENT where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:34.80 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
-- (1) Delete in class TdbfAttachement
 
 
delete from dbo.TDMFDOCUMENT
 
delete from dbo.TDMFDOCUMENT
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004')
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:3.98 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
-- (0) Reference on TdbfMessage class TdbfMessage.AnswerTo
 
 
update dbo.TDBFMESSAGE set oidAnswerTo=NULL
 
update dbo.TDBFMESSAGE set oidAnswerTo=NULL
 
where oidAnswerTo in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
 
where oidAnswerTo in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:15.94 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
insert into dbo.sysGlbTemp
 
insert into dbo.sysGlbTemp
 
select '000000000000000000040000811E0005',oid from dbo.TDBFMESSAGEBOXASSMESSAGE where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
 
select '000000000000000000040000811E0005',oid from dbo.TDBFMESSAGEBOXASSMESSAGE where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:8.04 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
-- (1) Delete in class TdbfMessageBoxAssMessage
 
 
delete from dbo.TDBFMESSAGEBOXASSMESSAGE
 
delete from dbo.TDBFMESSAGEBOXASSMESSAGE
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005')
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:17.16 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
-- (0) Delete in class TdbfMessage
 
 
delete from dbo.TDBFMESSAGE
 
delete from dbo.TDBFMESSAGE
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
 
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:4.96 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004'
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004'
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:0.61 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005'
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005'
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:0.44 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003'
 
delete from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003'
  
** Query:1045 Session:9895450 DataBase:dbMasterV560
 
** Time:0.45 ms PrepareTime:0.00 ms Fetch:0 Query:1045 Session:9895450 DataBase:dbMasterV560
 
** DebugStr:TTransaction.BeginLongTran
 
 
COMMIT TRANSACTION
 
COMMIT TRANSACTION
 
</pre>
 
</pre>
  
 
[[Category:Boîtes à messages]]
 
[[Category:Boîtes à messages]]

Version du 15 avril 2015 à 07:17

Ce code SQL permet de vider le contenu d'une boîte à message :

Replacer chfou par le nom de la boite et '2008-01-01 00:00:00' par la date désirée

BEGIN TRANSACTION
insert into dbo.sysGlbTemp
select '000000000000000000020000811E0003',t0.oid from dbo.TDBFMESSAGE t0 WITH (NOLOCK)
where (t0.idOTP = 2)
and ((t0.ReceivedFrom = 'chfou') and (t0.DateCreate < Convert(DateTime,'2008-01-01 00:00:00',120)))

insert into dbo.sysGlbTemp
select '000000000000000000870000811E0004',oid from dbo.TDMFDOCUMENT where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')

delete from dbo.TDMFDOCUMENT
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004')

update dbo.TDBFMESSAGE set oidAnswerTo=NULL
where oidAnswerTo in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')

insert into dbo.sysGlbTemp
select '000000000000000000040000811E0005',oid from dbo.TDBFMESSAGEBOXASSMESSAGE where oiddbfMessage in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')

delete from dbo.TDBFMESSAGEBOXASSMESSAGE
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005')

delete from dbo.TDBFMESSAGE
where oid in (select oid from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003')

delete from dbo.sysGlbTemp where idOpe='000000000000000000870000811E0004'

delete from dbo.sysGlbTemp where idOpe='000000000000000000040000811E0005'

delete from dbo.sysGlbTemp where idOpe='000000000000000000020000811E0003'

COMMIT TRANSACTION
Outils personnels