Hello Sebastian thanks for you quick response. I did what you mentioned and the errors were basically reduced to two and none of them syntax errors here is
the new sql based on your recommendations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/* Truncate EventLog - Version 0.9.8 (2015-07-25)
================================================================================
(c) Sebastian Leupold, dnnWerk/gamma concept mbH 2014-2015
Run this Script to remove all entries of EventLog in DNN Platform V.5.0.0 - 7.4.0
== Please make sure to use latest version from http://dnnscript.codeplex.com ===
Instructions:
=============
- Install by running as script from SQL item in Host menu inside DNN or run in
SQL Server Management Studio, after replacing placeholders dbo. and
""- by its proper values from web.config file.
- Make sure that the currently used account is member of dbOwner database role.
License and Disclaimer:
=======================
Published under Microsoft Open Source Reciprocal License (Ms-RL). For details,
please read http://dnnscript.codeplex.com/license.
Feel free to use this script as you need, but there is no warranty or liability
for any damage or effort, eventually been caused.
Please report issues at https://dnnscript.codeplex.com/WorkItem/Create
================================================================================
*/
IF EXISTS (SELECT * FROM sys.sysobjects WHERE id = object_id(N'dbo.[""- sys_currentDNNVersion]') AND Type = N'FN')
DROP FUNCTION dbo.[""-sys_currentDNNVersion]
GO
-- --------- create tooling: ---------
CREATE FUNCTION dbo.[""-sys_currentDNNVersion]()
RETURNS Int
AS
BEGIN
DECLARE @Vers Int;
SELECT Top(1) @Vers = Major * 10000 + Minor * 100 + Build FROM dbo.[""-Version] ORDER BY CreatedDate DESC;
RETURN @Vers;
END
GO
IF dbo.[""-sys_currentDNNVersion]() >= 70400 BEGIN
-- Drop Foreign Key Constraints:
DECLARE @fkName nVarChar(100) = Null;
SELECT @fkName = name FROM sys.foreign_keys
WHERE parent_object_id = OBJECT_ID(N'dbo.[""-ExceptionEvents]')
AND Object_id IN (SELECT constraint_object_id
FROM sys.foreign_key_columns F
JOIN sys.columns C ON F.parent_object_id = C.object_id AND F.parent_column_id = C.column_ID
WHERE C.Name = N'LogEventID');
IF Not @fkName Is Null
Exec(N'ALTER TABLE dbo.[""-ExceptionEvents] DROP CONSTRAINT [' + @fkName +'];');
SET @fkName = Null;
SELECT @fkName = name FROM sys.foreign_keys
WHERE parent_object_id = OBJECT_ID(N'dbo.[""-EventLog]')
AND Object_id IN (SELECT constraint_object_id
FROM sys.foreign_key_columns F
JOIN sys.columns C ON F.parent_object_id = C.object_id AND F.parent_column_id = C.column_ID
WHERE C.Name = N'ExceptionHash');
IF Not @fkName Is Null
Exec(N'ALTER TABLE dbo.[""-EventLog] DROP CONSTRAINT [' + @fkName +']')
END
GO
-- Truncate tables:
IF dbo.[""-sys_currentDNNVersion]() >= 70400 BEGIN
TRUNCATE TABLE dbo.[""-Exceptions]
TRUNCATE TABLE dbo.[""-ExceptionEvents]
TRUNCATE TABLE dbo.[""-EventLog]
END ELSE
TRUNCATE TABLE dbo.[""-EventLog]
GO
IF dbo.[""-sys_currentDNNVersion]() >= 70400 BEGIN
-- Recreate Foreign Key Constraints (using common naming):
ALTER TABLE dbo.[""-ExceptionEvents]
WITH CHECK ADD CONSTRAINT [FK_""-ExceptionEvents_EventLog]
FOREIGN KEY([LogEventID])
REFERENCES dbo.[""-EventLog] ([LogEventID])
ON DELETE CASCADE;
ALTER TABLE dbo.[""-EventLog]
WITH CHECK ADD CONSTRAINT [FK_""-EventLog_Exceptions]
FOREIGN KEY([ExceptionHash])
REFERENCES dbo.[""-Exceptions] ([ExceptionHash])
ON DELETE NO ACTION;
END
GO
DROP FUNCTION dbo.[""-sys_currentDNNVersion]
GO
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Below are the errors thrown from sql server 2012
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Msg 208, Level 16, State 1, Line 2
Invalid object name 'dbo.""-Version'.
Msg 208, Level 16, State 1, Line 3
Invalid object name 'dbo.""-Version'.
Msg 4701, Level 16, State 1, Line 8
Cannot find the object """-EventLog" because it does not exist or you do not have permissions.
Msg 208, Level 16, State 1, Line 2
Invalid object name 'dbo.""-Version'.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
I know I have permissions to my tables as I am signed in as admin and I tested truncating the sitelog and the schedulehistory table and that worked fine under my account. Any ideas for this error. I double checked my table prefixes just to verify it matched what the web.config file said and indeed it did.
Thanks for your help.