System.Data.SqlClient.SqlException: Line 6: Incorrect syntax near ';'.
'ROW_NUMBER' is not a recognized function name.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL)
at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions)
CREATE PROCEDURE dbo.PurgeEventLog
AS
;WITH logcounts AS
(
SELECT
LogEventID,
LogConfigID,
ROW_NUMBER() OVER(PARTITION BY LogConfigID ORDER BY LogCreateDate DESC) AS logEventSequence
FROM dbo.EventLog
)
DELETE dbo.EventLog
FROM dbo.EventLog el
JOIN logcounts lc ON el.LogEventID = lc.LogEventID
INNER JOIN dbo.EventLogConfig elc ON elc.ID = lc.LogConfigID
WHERE elc.KeepMostRecent <> -1
AND lc.logEventSequence > elc.KeepMostRecent
System.Data.SqlClient.SqlException: Line 6: Incorrect syntax near 'max'.
Line 7: Incorrect syntax near 'max'.
Must declare the variable '@header'.
Must declare the variable '@Header'.
Must declare the variable '@header'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DotNetNuke.Data.SqlDataProvider.ExecuteADOScript(String SQL)
at DotNetNuke.Data.SqlDataProvider.ExecuteScript(String Script, Boolean UseTransactions)
/* migrate module values to tabmodules */
declare @moduleID int
declare @moduleTitle [nvarchar](256)
declare @header nvarchar(max)
declare @footer nvarchar(max)
--Iterate through each module
DECLARE Module_Cursor CURSOR FOR
SELECT moduleID,ModuleTitle, Header, Footer from dbo.Modules
OPEN Module_Cursor
--get first
FETCH NEXT FROM Module_Cursor
into @moduleID,@moduleTitle,@header,@footer
WHILE @@FETCH_STATUS = 0
BEGIN
update dbo.tabmodules set ModuleTitle=@moduleTitle,Header=@Header,Footer=@Footer where moduleID=@moduleID
FETCH NEXT FROM Module_Cursor
into @moduleID,@moduleTitle,@header,@footer
END
CLOSE Module_Cursor;
DEALLOCATE Module_Cursor;