Skip to content

Instantly share code, notes, and snippets.

@roman-yagodin
Last active August 29, 2015 14:20
Show Gist options
  • Save roman-yagodin/130105a946a587c9bcf6 to your computer and use it in GitHub Desktop.
Save roman-yagodin/130105a946a587c9bcf6 to your computer and use it in GitHub Desktop.
USE [Dotnetnuke7]
GO
/****** Object: StoredProcedure [dbo].[R7_DnnCleanup] Script Date: 07.05.2015 11:27:52 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Roman M. Yagodin
-- Create date: 07.05.2015
-- Description: DNN Cleanup (after backup)
-- =============================================
CREATE PROCEDURE [dbo].[R7_DnnCleanup]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Clean TabUrls from deleted tabs
DELETE FROM dbo.TabUrls WHERE TabID NOT IN (SELECT TabID FROM dbo.Tabs);
-- Clean UrlTracking from deleted modules and null ones
DELETE FROM dbo.UrlTracking WHERE ModuleId IS NULL AND LastClick IS NULL;
DELETE FROM dbo.UrlTracking WHERE ModuleId NOT IN (SELECT ModuleId FROM dbo.Modules);
-- Clean EventLog & Shedule History
TRUNCATE TABLE EventLog;
TRUNCATE TABLE ScheduleHistory;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment