Скрипт создания хранимой процедуры ClearLog для очистки внешней базы данных MS SQL Server
CREATE PROCEDURE [dbo].[ClearLog] @Date DateTime, @ServerID int
AS
BEGIN
DELETE FROM AdminGroupLog WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM AdminLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM AVLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM ExtCounterLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM NetStatLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM ProxyLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM SMTPFltLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM SMTPSendLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM SMTPTraceLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM TariffLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM UserBillLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM UserCounterLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
DELETE FROM UserLog
WHERE ([Time]<@Date) and (ServerID=@ServerID)
END
При выполнении хранимой процедуры ClearLog должны быть заданы следующие параметры.
@Date: дата, до которой будет произведена очистка данных в таблицах внешней базы данных.
@ServerId: Id сервера, задаваемый при конфигурировании внешнего SQL-сервера (по умолчанию 0).
Пример вызова хранимой процедуры:
Set dateformat DMY
exec dbo.ClearLog '31.01.2009', 0
Текущая страница справки: http://help.smart-soft.ru/doc20/index.html?taskclearexternaldatabase.htm