Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Move/Update to 5.00.01 on IIS - dbo.UpdateDatabaseVersionAndNameMove/Update to 5.00.01 on IIS - dbo.UpdateDatabaseVersionAndName
Previous
 
Next
New Post
4/22/2009 4:30 PM
 

 

Ok, I will admit what I have done is probably not smart. I backed up my C:\DotNetNuke dir, which is where I had IIS pointed instead of C:\Inetpub\wwwroot, and completely wiped my 2003 server and reinstalled. Installed SQL Express 2005 back on, and copied the DotNetNuke dir back and have been going through setting it back up - I'm getting the following error, any ideas?

 

Upgrading DotNetNuke
Current Assembly Version: 05.00.01
Current Database Version: 05.00.00



Upgrade Status Report
00:00:00.031 - Upgrading to Version: 5.0.1
00:00:00.468 -   Executing Script: 05.00.01.SqlDataProvider Error! (see 05.00.01.log for more information)


 


--------------------------------------------------------------------------------

Server Error in '/' Application.
--------------------------------------------------------------------------------

The stored procedure 'dbo.UpdateDatabaseVersionAndName' doesn't exist.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The stored procedure 'dbo.UpdateDatabaseVersionAndName' doesn't exist.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  

Stack Trace:


[InvalidOperationException: The stored procedure 'dbo.UpdateDatabaseVersionAndName' doesn't exist.]
   System.Data.SqlClient.SqlCommand.DeriveParameters() +1962973
   System.Data.SqlClient.SqlCommandBuilder.DeriveParameters(SqlCommand command) +121
   Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.DiscoverSpParameterSet(SqlConnection connection, String spName, Boolean includeReturnValueParameter, Object[] parameterValues) +242
   Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSetInternal(SqlConnection connection, String spName, Boolean includeReturnValueParameter) +343
   Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSet(String connectionString, String spName, Boolean includeReturnValueParameter) +175
   Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSet(String connectionString, String spName) +45
   Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) +206
   DotNetNuke.Data.SqlDataProvider.UpdateDatabaseVersion(Int32 Major, Int32 Minor, Int32 Build, String Name) +217
   DotNetNuke.Common.Globals.UpdateDataBaseVersion(Int32[] version) +59
   DotNetNuke.Services.Upgrade.Upgrade.UpgradeVersion(String strScriptFile, Boolean writeFeedback) +139
   DotNetNuke.Services.Upgrade.Upgrade.UpgradeDNN(String strProviderPath, String strDatabaseVersion) +395
   DotNetNuke.Services.Install.Install.UpgradeApplication() +875
   DotNetNuke.Services.Install.Install.Page_Load(Object sender, EventArgs e) +272
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

 
New Post
4/22/2009 6:41 PM
 

please check the upgrade log, located in /providers/dataproviders/sqldataprovider.

Do not try to rerun the upgrade without analysis of the issue cause.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
4/23/2009 9:50 AM
 

System.Data.SqlClient.SqlException: Cannot find the object "dbo.Dashboard_Controls" because it does not exist or you do not have permissions.
   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)



IF (SELECT COUNT(*) FROM syscolumns WHERE [Name] = 'PackageID' AND id = object_id('dbo.Dashboard_Controls')) = 0
    BEGIN
        ALTER TABLE dbo.Dashboard_Controls
            ADD PackageID int NOT NULL CONSTRAINT DF_Dashboard_Controls_PackageID DEFAULT -1
    END


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_AddControl' in the database.
   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.Dashboard_AddControl  

    @PackageId                            int,
    @DashboardControlKey                 nvarchar(50),
    @IsEnabled                            bit,
    @DashboardControlSrc                nvarchar(250),
    @DashboardControlLocalResources     nvarchar(250),
    @ControllerClass                    nvarchar(250),
    @ViewOrder                            int

AS
    IF @ViewOrder = -1
        SET @ViewOrder = (SELECT TOP 1 ViewOrder FROM Dashboard_Controls ORDER BY ViewOrder DESC) + 1

    INSERT INTO dbo.Dashboard_Controls (
        PackageId,
        DashboardControlKey,
        IsEnabled,
        DashboardControlSrc,
        DashboardControlLocalResources,
        ControllerClass,
        ViewOrder
    )
    VALUES (
        @PackageId,
        @DashboardControlKey,
        @IsEnabled,
        @DashboardControlSrc,
        @DashboardControlLocalResources,
        @ControllerClass,
        @ViewOrder
    )

    SELECT SCOPE_IDENTITY()
    


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_DeleteControl' in the database.
   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.Dashboard_DeleteControl  

    @DashboardControlID int

AS
    DELETE dbo.Dashboard_Controls
    WHERE DashboardControlID = @DashboardControlID
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.Dashboard_GetDashboardControlByKey', because it does not exist or you do not have permission.
   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)



/* Add Dashboard_GetDashboardControlByKey Procedure */
/****************************************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[Dashboard_GetDashboardControlByKey]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.Dashboard_GetDashboardControlByKey


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_GetDashboardControlByKey' in the database.
   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.Dashboard_GetDashboardControlByKey  
    @DashboardControlKey nvarchar(50)
AS
    
    SELECT *
      FROM dbo.Dashboard_Controls
        WHERE DashboardControlKey = @DashboardControlKey
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.GetPermissionsByFolder', because it does not exist or you do not have permission.
   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)


IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[GetPermissionsByFolder]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.GetPermissionsByFolder


System.Data.SqlClient.SqlException: There is already an object named 'GetPermissionsByFolder' in the database.
   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.GetPermissionsByFolder
AS
    SELECT  PermissionID,
        PermissionCode,
        PermissionKey,
        PermissionName
    FROM    dbo.Permission
    WHERE   PermissionCode = 'SYSTEM_FOLDER'
    ORDER BY PermissionID


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.GetPermissionsByPortalDesktopModule', because it does not exist or you do not have permission.
   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)


IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[GetPermissionsByPortalDesktopModule]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.GetPermissionsByPortalDesktopModule


System.Data.SqlClient.SqlException: There is already an object named 'GetPermissionsByPortalDesktopModule' in the database.
   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.GetPermissionsByPortalDesktopModule
AS
    SELECT  PermissionID,
        PermissionCode,
        PermissionKey,
        ModuleDefID,
        PermissionName
    FROM    dbo.Permission
    WHERE   PermissionCode = 'SYSTEM_DESKTOPMODULE'
    ORDER BY PermissionID


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.UpdateServer', because it does not exist or you do not have permission.
   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)



/* Fix UpdateServer Procedure */
/******************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[UpdateServer]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.UpdateServer


System.Data.SqlClient.SqlException: There is already an object named 'UpdateServer' in the database.
   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.UpdateServer
    @ServerName            nvarchar(50),
    @CreatedDate        datetime,
    @LastActivityDate    datetime
AS

    DECLARE @ServerID int
    SET @ServerID = (SELECT ServerID FROM dbo.WebServers WHERE ServerName = @ServerName)

    IF @ServerID IS NULL
        BEGIN
            -- Insert
            INSERT INTO dbo.WebServers (
                ServerName,
                CreatedDate,
                LastActivityDate
            )
            VALUES (
                @ServerName,
                @CreatedDate,
                @LastActivityDate
            )
        END
    ELSE
        BEGIN
            -- Update
            UPDATE dbo.WebServers
                SET LastActivityDate = @LastActivityDate    
                WHERE  ServerName = @ServerName
        END


System.Data.SqlClient.SqlException: There is already an object named 'GetSearchResultsByWord' in the database.
   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.[GetSearchResultsByWord]
    @PortalID    int,
    @Word        nvarchar(100)
AS
    SELECT si.SearchItemID,
        sw.Word,
        siw.Occurrences,
        siw.Occurrences + 1000 AS Relevance,
        m.ModuleID,
        tm.TabID,
        si.Title,
        si.Description,
        si.Author,
        si.PubDate,
        si.SearchKey,
        si.Guid,
        si.ImageFileId,
        u.FirstName + ' ' + u.LastName As AuthorName,
        m.PortalId
    FROM    dbo.SearchWord sw
        INNER JOIN dbo.SearchItemWord siw ON sw.SearchWordsID = siw.SearchWordsID
        INNER JOIN dbo.SearchItem si ON siw.SearchItemID = si.SearchItemID
        INNER JOIN dbo.Modules m ON si.ModuleId = m.ModuleID
        LEFT OUTER JOIN dbo.TabModules tm ON si.ModuleId = tm.ModuleID
        INNER JOIN dbo.Tabs t ON tm.TabID = t.TabID
        LEFT OUTER JOIN dbo.Users u ON si.Author = u.UserID
    WHERE   (((m.StartDate Is Null) OR (GetDate() > m.StartDate)) AND ((m.EndDate Is Null) OR (GetDate() < m.EndDate)))
        AND (((t.StartDate Is Null) OR (GetDate() > t.StartDate)) AND ((t.EndDate Is Null) OR (GetDate() < t.EndDate)))
        AND (sw.Word = @Word)
        AND (t.IsDeleted = 0)
        AND (m.IsDeleted = 0)
        AND (t.PortalID = @PortalID)
    ORDER BY Relevance DESC


System.Data.SqlClient.SqlException: There is already an object named 'GetServices' in the database.
   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.GetServices  
    @PortalId  int,
    @UserId    int

AS
    SELECT     
        R.*,
        UR.UserRoleID,
        UR.UserID,
        UR.ExpiryDate,
        UR.IsTrialUsed,
        UR.EffectiveDate,
        U.DisplayName,
        U.Email
    FROM dbo.Users U
        INNER JOIN dbo.UserRoles AS UR ON U.UserID = UR.UserID
        RIGHT OUTER JOIN dbo.Roles AS R ON UR.RoleID = R.RoleID AND UR.UserID = @UserId
    WHERE  R.PortalId = @PortalId AND R.IsPublic = 1
    ORDER BY R.RoleName
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.AddEventLog', because it does not exist or you do not have permission.
   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)



/* Fix AddEventLog Procedure */
/*****************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[AddEventLog]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.AddEventLog


System.Data.SqlClient.SqlException: There is already an object named 'AddEventLog' in the database.
   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.AddEventLog  
    @LogGUID varchar(36),
    @LogTypeKey nvarchar(35),
    @LogUserID int,
    @LogUserName nvarchar(50),
    @LogPortalID int,
    @LogPortalName nvarchar(100),
    @LogCreateDate datetime,
    @LogServerName nvarchar(50),
    @LogProperties ntext,
    @LogConfigID int
AS
    IF NOT EXISTS (SELECT * FROM dbo.EventLogTypes WHERE LogTypeKey = @LogTypeKey)
        BEGIN
        -- Add new Event Type
            EXEC dbo.AddEventLogType @LogTypeKey, @LogTypeKey, N'', N'DotNetNuke.Logging.EventLogType', N'GeneralAdminOperation'

        -- Add new Event Type Config
            EXEC dbo.AddEventLogConfig @LogTypeKey, NULL, 0, -1, 0, 1, 1, 1, N'', N''
        END

    INSERT INTO dbo.EventLog
        (LogGUID,
        LogTypeKey,
        LogUserID,
        LogUserName,
        LogPortalID,
        LogPortalName,
        LogCreateDate,
        LogServerName,
        LogProperties,
        LogConfigID)
    VALUES
        (@LogGUID,
        @LogTypeKey,
        @LogUserID,
        @LogUserName,
        @LogPortalID,
        @LogPortalName,
        @LogCreateDate,
        @LogServerName,
        @LogProperties,
        @LogConfigID)

    DECLARE @NotificationActive bit
    DECLARE @NotificationThreshold bit
    DECLARE @ThresholdQueue int
    DECLARE @NotificationThresholdTime int
    DECLARE @NotificationThresholdTimeType int
    DECLARE @MinDateTime smalldatetime
    DECLARE @CurrentDateTime smalldatetime

    SET @CurrentDateTime = getDate()


    SELECT TOP 1 @NotificationActive = EmailNotificationIsActive,
        @NotificationThreshold = NotificationThreshold,
        @NotificationThresholdTime = NotificationThresholdTime,
        @NotificationThresholdTimeType = NotificationThresholdTimeType,
        @MinDateTime =
            CASE
                 --seconds
                WHEN NotificationThresholdTimeType=1 THEN DateAdd(second, NotificationThresholdTime * -1, @CurrentDateTime)
                --minutes
                WHEN NotificationThresholdTimeType=2  THEN DateAdd(minute, NotificationThresholdTime * -1, @CurrentDateTime)
                --hours
                WHEN NotificationThresholdTimeType=3  THEN DateAdd(Hour, NotificationThresholdTime * -1, @CurrentDateTime)
                --days
                WHEN NotificationThresholdTimeType=4  THEN DateAdd(Day, NotificationThresholdTime * -1, @CurrentDateTime)
            END
    FROM dbo.EventLogConfig
    WHERE ID = @LogConfigID

    IF @NotificationActive=1
    BEGIN
        
        SELECT @ThresholdQueue = COUNT(*)
        FROM dbo.EventLog
            INNER JOIN dbo.EventLogConfig
                ON dbo.EventLog.LogConfigID = dbo.EventLogConfig.ID
        WHERE LogCreateDate > @MinDateTime

        PRINT 'MinDateTime=' + convert(varchar(20), @MinDateTime)
        PRINT 'ThresholdQueue=' + convert(varchar(20), @ThresholdQueue)
        PRINT 'NotificationThreshold=' + convert(varchar(20), @NotificationThreshold)

        IF @ThresholdQueue > @NotificationThreshold
        BEGIN
            UPDATE dbo.EventLog
            SET LogNotificationPending = 1
            WHERE LogConfigID = @LogConfigID
                AND LogNotificationPending IS NULL        
                AND LogCreateDate > @MinDateTime
        END
    END
    


System.Data.SqlClient.SqlException: There is already an object named 'GetRoleGroups' in the database.
   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.GetRoleGroups  

    @PortalID        int
    
AS
    SELECT
        RoleGroupId,
        PortalId,
        RoleGroupName,
        Description
    FROM dbo.RoleGroups
    WHERE  PortalId = @PortalID
    ORDER BY RoleGroupName    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.RegisterAssembly', because it does not exist or you do not have permission.
   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)



/* Fix RegisterAssembly Procedure */
/**********************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[RegisterAssembly]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.RegisterAssembly


System.Data.SqlClient.SqlException: There is already an object named 'vw_Tabs' in the database.
   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 VIEW dbo.vw_Tabs  

AS
    SELECT     
        TabID,
        TabOrder,
        PortalID,
        TabName,
        IsVisible,
        ParentId,
        [Level],
        CASE WHEN LEFT(LOWER(T.IconFile), 6) = 'fileid' THEN (SELECT Folder + FileName FROM dbo.Files WHERE 'fileid=' + CONVERT(varchar, dbo.Files.FileID) = T.IconFile) ELSE T.IconFile END AS IconFile,
        DisableLink,
        Title,
        Description,
        KeyWords,
        IsDeleted,
        SkinSrc,
        ContainerSrc,
        TabPath,
        StartDate,
        EndDate,
        Url,
        CASE WHEN EXISTS (SELECT 1 FROM  dbo.Tabs T2 WHERE T2.ParentId = T.TabId) THEN 'true' ELSE 'false' END AS HasChildren,
        RefreshInterval,
        PageHeadText,
        IsSecure,
        PermanentRedirect
    FROM dbo.Tabs AS T
    


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'LastIPAddress' in table 'dbo.Users' is specified more than once.
   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)



/* Add Columns to Users Table */
/************************************/

ALTER TABLE dbo.Users
    ADD LastIPAddress nvarchar(50) NULL


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'IsDeleted' in table 'dbo.UserPortals' is specified more than once.
   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)



/* Add Columns to UserPortals Table */
/************************************/

ALTER TABLE dbo.UserPortals
    ADD
        IsDeleted bit NOT NULL CONSTRAINT DF_UserPortals_IsDeleted DEFAULT 0,
        RefreshRoles bit NOT NULL CONSTRAINT DF_UserPortals_RefreshRoles DEFAULT 0


System.Data.SqlClient.SqlException: Cannot drop the view 'dbo.vw_Users', because it does not exist or you do not have permission.
   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)



/* Update Users View */
/*********************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[vw_Users]') AND OBJECTPROPERTY(id, N'IsVIEW') = 1)
  DROP VIEW dbo.vw_Users


System.Data.SqlClient.SqlException: There is already an object named 'vw_Users' in the database.
   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 VIEW dbo.vw_Users  

AS
    SELECT     
        U.UserID,
        UP.PortalId,
        U.Username,
        U.FirstName,
        U.LastName,
        U.DisplayName,
        U.IsSuperUser,
        U.Email,
        U.AffiliateId,
        U.UpdatePassword,
        UP.Authorised,
        UP.IsDeleted,
        UP.RefreshRoles,
        U.LastIPAddress
    FROM
        dbo.Users AS U
            LEFT OUTER JOIN dbo.UserPortals AS UP ON U.UserID = UP.UserId   


System.Data.SqlClient.SqlException: There is already an object named 'GetAllUsers' in the database.
   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.GetAllUsers  
    @PortalId       int,
    @PageIndex      int,
    @PageSize       int
AS
    BEGIN
        -- Set the page bounds
        DECLARE @PageLowerBound INT
        DECLARE @PageUpperBound INT
        SET @PageLowerBound = @PageSize * @PageIndex
        SET @PageUpperBound = @PageSize - 1 + @PageLowerBound

        -- Create a temp table TO store the select results
        CREATE TABLE #PageIndexForUsers
        (
            IndexId int IDENTITY (0, 1) NOT NULL,
            UserId int
        )

        -- Insert into our temp table
        INSERT INTO #PageIndexForUsers (UserId)
            SELECT UserId
            FROM   dbo.vw_Users
            WHERE  (PortalId = @PortalId OR (PortalId Is Null AND @PortalId is null ))    
                AND (IsDeleted = 0 OR IsDeleted Is NULL)
            ORDER BY UserName

        SELECT  *
        FROM    dbo.vw_Users u,
                #PageIndexForUsers p
        WHERE  u.UserId = p.UserId
            AND (PortalId = @PortalId OR (PortalId Is Null AND @PortalId is null ))
                AND (IsDeleted = 0 OR IsDeleted Is NULL)
            AND p.IndexId >= @PageLowerBound AND p.IndexId <= @PageUpperBound
        ORDER BY UserName

        SELECT  TotalRecords = COUNT(*)
        FROM    #PageIndexForUsers

    END


System.Data.SqlClient.SqlException: There is already an object named 'UpdateUser' in the database.
   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.UpdateUser  
    @UserID         int,
    @PortalID        int,
    @FirstName        nvarchar(50),
    @LastName        nvarchar(50),
    @Email          nvarchar(256),
    @DisplayName    nvarchar(100),
    @UpdatePassword    bit,
    @Authorised        bit,
    @RefreshRoles    bit,
    @LastIPAddress    nvarchar(50)

AS
    UPDATE dbo.Users
        SET
            FirstName = @FirstName,
            LastName = @LastName,
            Email = @Email,
            DisplayName = @DisplayName,
            UpdatePassword = @UpdatePassword,
            LastIPAddress = @LastIPAddress
        WHERE  UserId = @UserID

    UPDATE dbo.UserPortals
        SET
            Authorised = @Authorised,
            RefreshRoles = @RefreshRoles
        WHERE  UserId = @UserID
            AND PortalId = @PortalID


System.Data.SqlClient.SqlException: There is already an object named 'GetSearchResultsByWord' in the database.
   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.GetSearchResultsByWord
    @PortalID    int,
    @Word        nvarchar(100)
AS
    SELECT si.SearchItemID,
        sw.Word,
        siw.Occurrences,
        siw.Occurrences + 1000 AS Relevance,
        m.ModuleID,
        tm.TabID,
        si.Title,
        si.Description,
        si.Author,
        si.PubDate,
        si.SearchKey,
        si.Guid,
        si.ImageFileId,
        u.FirstName + ' ' + u.LastName As AuthorName,
        m.PortalId
    FROM    dbo.SearchWord sw
        INNER JOIN dbo.SearchItemWord siw ON sw.SearchWordsID = siw.SearchWordsID
        INNER JOIN dbo.SearchItem si ON siw.SearchItemID = si.SearchItemID
        INNER JOIN dbo.Modules m ON si.ModuleId = m.ModuleID
        LEFT OUTER JOIN dbo.TabModules tm ON si.ModuleId = tm.ModuleID
        INNER JOIN dbo.Tabs t ON tm.TabID = t.TabID
        LEFT OUTER JOIN dbo.Users u ON si.Author = u.UserID
    WHERE   (((m.StartDate Is Null) OR (GetDate() > m.StartDate)) AND ((m.EndDate Is Null) OR (GetDate() < m.EndDate)))
        AND (((t.StartDate Is Null) OR (GetDate() > t.StartDate)) AND ((t.EndDate Is Null) OR (GetDate() < t.EndDate)))
        AND (sw.Word = @Word)
        AND (t.IsDeleted = 0)
        AND (m.IsDeleted = 0)
        AND (t.PortalID = @PortalID)
    ORDER BY Relevance DESC


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'URL' in table 'dbo.WebServers' is specified more than once.
   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)



ALTER TABLE dbo.WebServers ADD
    URL nvarchar(255) NULL


Error: Violation of PRIMARY KEY constraint 'PK_EventLogTypes'. Cannot insert duplicate key in object 'dbo.EventLogTypes'.
The statement has been terminated.

 

 
New Post
4/23/2009 10:51 AM
 

System.Data.SqlClient.SqlException: Cannot find the object "dbo.Dashboard_Controls" because it does not exist or you do not have permissions.
   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)



IF (SELECT COUNT(*) FROM syscolumns WHERE [Name] = 'PackageID' AND id = object_id('dbo.Dashboard_Controls')) = 0
    BEGIN
        ALTER TABLE dbo.Dashboard_Controls
            ADD PackageID int NOT NULL CONSTRAINT DF_Dashboard_Controls_PackageID DEFAULT -1
    END


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_AddControl' in the database.
   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.Dashboard_AddControl  

    @PackageId                            int,
    @DashboardControlKey                 nvarchar(50),
    @IsEnabled                            bit,
    @DashboardControlSrc                nvarchar(250),
    @DashboardControlLocalResources     nvarchar(250),
    @ControllerClass                    nvarchar(250),
    @ViewOrder                            int

AS
    IF @ViewOrder = -1
        SET @ViewOrder = (SELECT TOP 1 ViewOrder FROM Dashboard_Controls ORDER BY ViewOrder DESC) + 1

    INSERT INTO dbo.Dashboard_Controls (
        PackageId,
        DashboardControlKey,
        IsEnabled,
        DashboardControlSrc,
        DashboardControlLocalResources,
        ControllerClass,
        ViewOrder
    )
    VALUES (
        @PackageId,
        @DashboardControlKey,
        @IsEnabled,
        @DashboardControlSrc,
        @DashboardControlLocalResources,
        @ControllerClass,
        @ViewOrder
    )

    SELECT SCOPE_IDENTITY()
    


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_DeleteControl' in the database.
   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.Dashboard_DeleteControl  

    @DashboardControlID int

AS
    DELETE dbo.Dashboard_Controls
    WHERE DashboardControlID = @DashboardControlID
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.Dashboard_GetDashboardControlByKey', because it does not exist or you do not have permission.
   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)



/* Add Dashboard_GetDashboardControlByKey Procedure */
/****************************************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[Dashboard_GetDashboardControlByKey]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.Dashboard_GetDashboardControlByKey


System.Data.SqlClient.SqlException: There is already an object named 'Dashboard_GetDashboardControlByKey' in the database.
   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.Dashboard_GetDashboardControlByKey  
    @DashboardControlKey nvarchar(50)
AS
    
    SELECT *
      FROM dbo.Dashboard_Controls
        WHERE DashboardControlKey = @DashboardControlKey
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.GetPermissionsByFolder', because it does not exist or you do not have permission.
   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)


IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[GetPermissionsByFolder]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.GetPermissionsByFolder


System.Data.SqlClient.SqlException: There is already an object named 'GetPermissionsByFolder' in the database.
   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.GetPermissionsByFolder
AS
    SELECT  PermissionID,
        PermissionCode,
        PermissionKey,
        PermissionName
    FROM    dbo.Permission
    WHERE   PermissionCode = 'SYSTEM_FOLDER'
    ORDER BY PermissionID


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.GetPermissionsByPortalDesktopModule', because it does not exist or you do not have permission.
   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)


IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[GetPermissionsByPortalDesktopModule]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.GetPermissionsByPortalDesktopModule


System.Data.SqlClient.SqlException: There is already an object named 'GetPermissionsByPortalDesktopModule' in the database.
   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.GetPermissionsByPortalDesktopModule
AS
    SELECT  PermissionID,
        PermissionCode,
        PermissionKey,
        ModuleDefID,
        PermissionName
    FROM    dbo.Permission
    WHERE   PermissionCode = 'SYSTEM_DESKTOPMODULE'
    ORDER BY PermissionID


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.UpdateServer', because it does not exist or you do not have permission.
   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)



/* Fix UpdateServer Procedure */
/******************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[UpdateServer]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.UpdateServer


System.Data.SqlClient.SqlException: There is already an object named 'UpdateServer' in the database.
   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.UpdateServer
    @ServerName            nvarchar(50),
    @CreatedDate        datetime,
    @LastActivityDate    datetime
AS

    DECLARE @ServerID int
    SET @ServerID = (SELECT ServerID FROM dbo.WebServers WHERE ServerName = @ServerName)

    IF @ServerID IS NULL
        BEGIN
            -- Insert
            INSERT INTO dbo.WebServers (
                ServerName,
                CreatedDate,
                LastActivityDate
            )
            VALUES (
                @ServerName,
                @CreatedDate,
                @LastActivityDate
            )
        END
    ELSE
        BEGIN
            -- Update
            UPDATE dbo.WebServers
                SET LastActivityDate = @LastActivityDate    
                WHERE  ServerName = @ServerName
        END


System.Data.SqlClient.SqlException: There is already an object named 'GetSearchResultsByWord' in the database.
   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.[GetSearchResultsByWord]
    @PortalID    int,
    @Word        nvarchar(100)
AS
    SELECT si.SearchItemID,
        sw.Word,
        siw.Occurrences,
        siw.Occurrences + 1000 AS Relevance,
        m.ModuleID,
        tm.TabID,
        si.Title,
        si.Description,
        si.Author,
        si.PubDate,
        si.SearchKey,
        si.Guid,
        si.ImageFileId,
        u.FirstName + ' ' + u.LastName As AuthorName,
        m.PortalId
    FROM    dbo.SearchWord sw
        INNER JOIN dbo.SearchItemWord siw ON sw.SearchWordsID = siw.SearchWordsID
        INNER JOIN dbo.SearchItem si ON siw.SearchItemID = si.SearchItemID
        INNER JOIN dbo.Modules m ON si.ModuleId = m.ModuleID
        LEFT OUTER JOIN dbo.TabModules tm ON si.ModuleId = tm.ModuleID
        INNER JOIN dbo.Tabs t ON tm.TabID = t.TabID
        LEFT OUTER JOIN dbo.Users u ON si.Author = u.UserID
    WHERE   (((m.StartDate Is Null) OR (GetDate() > m.StartDate)) AND ((m.EndDate Is Null) OR (GetDate() < m.EndDate)))
        AND (((t.StartDate Is Null) OR (GetDate() > t.StartDate)) AND ((t.EndDate Is Null) OR (GetDate() < t.EndDate)))
        AND (sw.Word = @Word)
        AND (t.IsDeleted = 0)
        AND (m.IsDeleted = 0)
        AND (t.PortalID = @PortalID)
    ORDER BY Relevance DESC


System.Data.SqlClient.SqlException: There is already an object named 'GetServices' in the database.
   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.GetServices  
    @PortalId  int,
    @UserId    int

AS
    SELECT     
        R.*,
        UR.UserRoleID,
        UR.UserID,
        UR.ExpiryDate,
        UR.IsTrialUsed,
        UR.EffectiveDate,
        U.DisplayName,
        U.Email
    FROM dbo.Users U
        INNER JOIN dbo.UserRoles AS UR ON U.UserID = UR.UserID
        RIGHT OUTER JOIN dbo.Roles AS R ON UR.RoleID = R.RoleID AND UR.UserID = @UserId
    WHERE  R.PortalId = @PortalId AND R.IsPublic = 1
    ORDER BY R.RoleName
    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.AddEventLog', because it does not exist or you do not have permission.
   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)



/* Fix AddEventLog Procedure */
/*****************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[AddEventLog]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.AddEventLog


System.Data.SqlClient.SqlException: There is already an object named 'AddEventLog' in the database.
   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.AddEventLog  
    @LogGUID varchar(36),
    @LogTypeKey nvarchar(35),
    @LogUserID int,
    @LogUserName nvarchar(50),
    @LogPortalID int,
    @LogPortalName nvarchar(100),
    @LogCreateDate datetime,
    @LogServerName nvarchar(50),
    @LogProperties ntext,
    @LogConfigID int
AS
    IF NOT EXISTS (SELECT * FROM dbo.EventLogTypes WHERE LogTypeKey = @LogTypeKey)
        BEGIN
        -- Add new Event Type
            EXEC dbo.AddEventLogType @LogTypeKey, @LogTypeKey, N'', N'DotNetNuke.Logging.EventLogType', N'GeneralAdminOperation'

        -- Add new Event Type Config
            EXEC dbo.AddEventLogConfig @LogTypeKey, NULL, 0, -1, 0, 1, 1, 1, N'', N''
        END

    INSERT INTO dbo.EventLog
        (LogGUID,
        LogTypeKey,
        LogUserID,
        LogUserName,
        LogPortalID,
        LogPortalName,
        LogCreateDate,
        LogServerName,
        LogProperties,
        LogConfigID)
    VALUES
        (@LogGUID,
        @LogTypeKey,
        @LogUserID,
        @LogUserName,
        @LogPortalID,
        @LogPortalName,
        @LogCreateDate,
        @LogServerName,
        @LogProperties,
        @LogConfigID)

    DECLARE @NotificationActive bit
    DECLARE @NotificationThreshold bit
    DECLARE @ThresholdQueue int
    DECLARE @NotificationThresholdTime int
    DECLARE @NotificationThresholdTimeType int
    DECLARE @MinDateTime smalldatetime
    DECLARE @CurrentDateTime smalldatetime

    SET @CurrentDateTime = getDate()


    SELECT TOP 1 @NotificationActive = EmailNotificationIsActive,
        @NotificationThreshold = NotificationThreshold,
        @NotificationThresholdTime = NotificationThresholdTime,
        @NotificationThresholdTimeType = NotificationThresholdTimeType,
        @MinDateTime =
            CASE
                 --seconds
                WHEN NotificationThresholdTimeType=1 THEN DateAdd(second, NotificationThresholdTime * -1, @CurrentDateTime)
                --minutes
                WHEN NotificationThresholdTimeType=2  THEN DateAdd(minute, NotificationThresholdTime * -1, @CurrentDateTime)
                --hours
                WHEN NotificationThresholdTimeType=3  THEN DateAdd(Hour, NotificationThresholdTime * -1, @CurrentDateTime)
                --days
                WHEN NotificationThresholdTimeType=4  THEN DateAdd(Day, NotificationThresholdTime * -1, @CurrentDateTime)
            END
    FROM dbo.EventLogConfig
    WHERE ID = @LogConfigID

    IF @NotificationActive=1
    BEGIN
        
        SELECT @ThresholdQueue = COUNT(*)
        FROM dbo.EventLog
            INNER JOIN dbo.EventLogConfig
                ON dbo.EventLog.LogConfigID = dbo.EventLogConfig.ID
        WHERE LogCreateDate > @MinDateTime

        PRINT 'MinDateTime=' + convert(varchar(20), @MinDateTime)
        PRINT 'ThresholdQueue=' + convert(varchar(20), @ThresholdQueue)
        PRINT 'NotificationThreshold=' + convert(varchar(20), @NotificationThreshold)

        IF @ThresholdQueue > @NotificationThreshold
        BEGIN
            UPDATE dbo.EventLog
            SET LogNotificationPending = 1
            WHERE LogConfigID = @LogConfigID
                AND LogNotificationPending IS NULL        
                AND LogCreateDate > @MinDateTime
        END
    END
    


System.Data.SqlClient.SqlException: There is already an object named 'GetRoleGroups' in the database.
   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.GetRoleGroups  

    @PortalID        int
    
AS
    SELECT
        RoleGroupId,
        PortalId,
        RoleGroupName,
        Description
    FROM dbo.RoleGroups
    WHERE  PortalId = @PortalID
    ORDER BY RoleGroupName    


System.Data.SqlClient.SqlException: Cannot drop the procedure 'dbo.RegisterAssembly', because it does not exist or you do not have permission.
   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)



/* Fix RegisterAssembly Procedure */
/**********************************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[RegisterAssembly]') AND OBJECTPROPERTY(id, N'IsPROCEDURE') = 1)
  DROP PROCEDURE dbo.RegisterAssembly


System.Data.SqlClient.SqlException: There is already an object named 'vw_Tabs' in the database.
   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 VIEW dbo.vw_Tabs  

AS
    SELECT     
        TabID,
        TabOrder,
        PortalID,
        TabName,
        IsVisible,
        ParentId,
        [Level],
        CASE WHEN LEFT(LOWER(T.IconFile), 6) = 'fileid' THEN (SELECT Folder + FileName FROM dbo.Files WHERE 'fileid=' + CONVERT(varchar, dbo.Files.FileID) = T.IconFile) ELSE T.IconFile END AS IconFile,
        DisableLink,
        Title,
        Description,
        KeyWords,
        IsDeleted,
        SkinSrc,
        ContainerSrc,
        TabPath,
        StartDate,
        EndDate,
        Url,
        CASE WHEN EXISTS (SELECT 1 FROM  dbo.Tabs T2 WHERE T2.ParentId = T.TabId) THEN 'true' ELSE 'false' END AS HasChildren,
        RefreshInterval,
        PageHeadText,
        IsSecure,
        PermanentRedirect
    FROM dbo.Tabs AS T
    


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'LastIPAddress' in table 'dbo.Users' is specified more than once.
   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)



/* Add Columns to Users Table */
/************************************/

ALTER TABLE dbo.Users
    ADD LastIPAddress nvarchar(50) NULL


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'IsDeleted' in table 'dbo.UserPortals' is specified more than once.
   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)



/* Add Columns to UserPortals Table */
/************************************/

ALTER TABLE dbo.UserPortals
    ADD
        IsDeleted bit NOT NULL CONSTRAINT DF_UserPortals_IsDeleted DEFAULT 0,
        RefreshRoles bit NOT NULL CONSTRAINT DF_UserPortals_RefreshRoles DEFAULT 0


System.Data.SqlClient.SqlException: Cannot drop the view 'dbo.vw_Users', because it does not exist or you do not have permission.
   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)



/* Update Users View */
/*********************/

IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.[vw_Users]') AND OBJECTPROPERTY(id, N'IsVIEW') = 1)
  DROP VIEW dbo.vw_Users


System.Data.SqlClient.SqlException: There is already an object named 'vw_Users' in the database.
   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 VIEW dbo.vw_Users  

AS
    SELECT     
        U.UserID,
        UP.PortalId,
        U.Username,
        U.FirstName,
        U.LastName,
        U.DisplayName,
        U.IsSuperUser,
        U.Email,
        U.AffiliateId,
        U.UpdatePassword,
        UP.Authorised,
        UP.IsDeleted,
        UP.RefreshRoles,
        U.LastIPAddress
    FROM
        dbo.Users AS U
            LEFT OUTER JOIN dbo.UserPortals AS UP ON U.UserID = UP.UserId   


System.Data.SqlClient.SqlException: There is already an object named 'GetAllUsers' in the database.
   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.GetAllUsers  
    @PortalId       int,
    @PageIndex      int,
    @PageSize       int
AS
    BEGIN
        -- Set the page bounds
        DECLARE @PageLowerBound INT
        DECLARE @PageUpperBound INT
        SET @PageLowerBound = @PageSize * @PageIndex
        SET @PageUpperBound = @PageSize - 1 + @PageLowerBound

        -- Create a temp table TO store the select results
        CREATE TABLE #PageIndexForUsers
        (
            IndexId int IDENTITY (0, 1) NOT NULL,
            UserId int
        )

        -- Insert into our temp table
        INSERT INTO #PageIndexForUsers (UserId)
            SELECT UserId
            FROM   dbo.vw_Users
            WHERE  (PortalId = @PortalId OR (PortalId Is Null AND @PortalId is null ))    
                AND (IsDeleted = 0 OR IsDeleted Is NULL)
            ORDER BY UserName

        SELECT  *
        FROM    dbo.vw_Users u,
                #PageIndexForUsers p
        WHERE  u.UserId = p.UserId
            AND (PortalId = @PortalId OR (PortalId Is Null AND @PortalId is null ))
                AND (IsDeleted = 0 OR IsDeleted Is NULL)
            AND p.IndexId >= @PageLowerBound AND p.IndexId <= @PageUpperBound
        ORDER BY UserName

        SELECT  TotalRecords = COUNT(*)
        FROM    #PageIndexForUsers

    END


System.Data.SqlClient.SqlException: There is already an object named 'UpdateUser' in the database.
   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.UpdateUser  
    @UserID         int,
    @PortalID        int,
    @FirstName        nvarchar(50),
    @LastName        nvarchar(50),
    @Email          nvarchar(256),
    @DisplayName    nvarchar(100),
    @UpdatePassword    bit,
    @Authorised        bit,
    @RefreshRoles    bit,
    @LastIPAddress    nvarchar(50)

AS
    UPDATE dbo.Users
        SET
            FirstName = @FirstName,
            LastName = @LastName,
            Email = @Email,
            DisplayName = @DisplayName,
            UpdatePassword = @UpdatePassword,
            LastIPAddress = @LastIPAddress
        WHERE  UserId = @UserID

    UPDATE dbo.UserPortals
        SET
            Authorised = @Authorised,
            RefreshRoles = @RefreshRoles
        WHERE  UserId = @UserID
            AND PortalId = @PortalID


System.Data.SqlClient.SqlException: There is already an object named 'GetSearchResultsByWord' in the database.
   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.GetSearchResultsByWord
    @PortalID    int,
    @Word        nvarchar(100)
AS
    SELECT si.SearchItemID,
        sw.Word,
        siw.Occurrences,
        siw.Occurrences + 1000 AS Relevance,
        m.ModuleID,
        tm.TabID,
        si.Title,
        si.Description,
        si.Author,
        si.PubDate,
        si.SearchKey,
        si.Guid,
        si.ImageFileId,
        u.FirstName + ' ' + u.LastName As AuthorName,
        m.PortalId
    FROM    dbo.SearchWord sw
        INNER JOIN dbo.SearchItemWord siw ON sw.SearchWordsID = siw.SearchWordsID
        INNER JOIN dbo.SearchItem si ON siw.SearchItemID = si.SearchItemID
        INNER JOIN dbo.Modules m ON si.ModuleId = m.ModuleID
        LEFT OUTER JOIN dbo.TabModules tm ON si.ModuleId = tm.ModuleID
        INNER JOIN dbo.Tabs t ON tm.TabID = t.TabID
        LEFT OUTER JOIN dbo.Users u ON si.Author = u.UserID
    WHERE   (((m.StartDate Is Null) OR (GetDate() > m.StartDate)) AND ((m.EndDate Is Null) OR (GetDate() < m.EndDate)))
        AND (((t.StartDate Is Null) OR (GetDate() > t.StartDate)) AND ((t.EndDate Is Null) OR (GetDate() < t.EndDate)))
        AND (sw.Word = @Word)
        AND (t.IsDeleted = 0)
        AND (m.IsDeleted = 0)
        AND (t.PortalID = @PortalID)
    ORDER BY Relevance DESC


System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'URL' in table 'dbo.WebServers' is specified more than once.
   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)



ALTER TABLE dbo.WebServers ADD
    URL nvarchar(255) NULL


Error: Violation of PRIMARY KEY constraint 'PK_EventLogTypes'. Cannot insert duplicate key in object 'dbo.EventLogTypes'.
The statement has been terminated.

 

 
New Post
4/24/2009 12:53 PM
 

Any ideas?

 

Thanks,

RushB

 

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Move/Update to 5.00.01 on IIS - dbo.UpdateDatabaseVersionAndNameMove/Update to 5.00.01 on IIS - dbo.UpdateDatabaseVersionAndName


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out