Hi, here is the log information I got...
Can I try to fix the problem in DB directly. Most error looks like there are duplicated key or table in the DB... Should I remove the duplicated data directly.
Or there is a better way to fix my issue?
Here is the log: 05.00.00.log
System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'EditorControlSrc' in table 'dbo.PackageTypes' 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 EditorControlSrc Column to PackageTypes */
/***********************************************/
ALTER TABLE dbo.PackageTypes
ADD EditorControlSrc nvarchar(250) NULL
System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'PackageID' in table 'dbo.DesktopModules' 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 PackageID Column to DesktopModules */
/******************************************/
ALTER TABLE dbo.DesktopModules
ADD PackageID int NOT NULL CONSTRAINT [DF_DesktopModules_PackageID] DEFAULT ((-1))
System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'IX_Permission'. Cannot insert duplicate key in object 'dbo.Permission'.
The statement has been terminated.
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 New DesktopModule Permission */
/************************************/
INSERT INTO dbo.Permission (
[PermissionCode],
[ModuleDefID],
[PermissionKey],
[PermissionName]
) VALUES (
'SYSTEM_DESKTOPMODULE',
-1,
'DEPLOY',
'Can Deploy'
)
System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'IX_ModuleControls'. Cannot insert duplicate key in object 'dbo.ModuleControls'.
The statement has been terminated.
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)
/* Move User Accounts Module Definition to the Security DesktopModule */
/*********************************************************************/
DECLARE @DesktopModuleID int
SET @DesktopModuleID = (SELECT DesktopModuleID FROM dbo.DesktopModules WHERE ModuleName = 'Security')
DECLARE @ModuleDefID int
SET @ModuleDefID = (SELECT ModuleDefID FROM dbo.ModuleDefinitions WHERE FriendlyName = 'User Accounts')
UPDATE dbo.ModuleDefinitions
SET DesktopModuleID = @DesktopModuleID
WHERE ModuleDefID = @ModuleDefID
UPDATE dbo.ModuleControls
SET ControlSrc = 'DesktopModules/Admin/Security/Users.ascx',
IconFile = '~/images/icon_users_32px.gif'
WHERE ControlSrc = 'Admin/Users/Users.ascx'
AND ModuleDefID = @ModuleDefID
UPDATE dbo.ModuleControls
SET ControlSrc = 'DesktopModules/Admin/Security/ManageUsers.ascx',
IconFile = '~/images/icon_users_32px.gif'
WHERE ControlSrc = 'Admin/Users/ManageUsers.ascx'
AND ModuleDefID = @ModuleDefID
UPDATE dbo.ModuleControls
SET ControlSrc = 'DesktopModules/Admin/Security/ProfileDefinitions.ascx',
IconFile = '~/images/icon_users_32px.gif'
WHERE ControlSrc = 'Admin/Users/ProfileDefinitions.ascx'
AND ModuleDefID = @ModuleDefID
UPDATE dbo.ModuleControls
SET ControlSrc = 'DesktopModules/Admin/Security/EditProfileDefinition.ascx',
IconFile = '~/images/icon_users_32px.gif'
WHERE ControlSrc = 'Admin/Users/EditProfileDefinition.ascx'
AND ModuleDefID = @ModuleDefID
UPDATE dbo.ModuleControls
SET ControlSrc = 'DesktopModules/Admin/Security/UserSettings.ascx'
WHERE ControlSrc = 'Admin/Users/UserSettings.ascx'
AND ModuleDefID = @ModuleDefID
INSERT INTO dbo.ModuleControls(
ModuleDefID,
ControlKey,
ControlTitle,
ControlSrc,
IconFile,
ControlType,
SupportsPartialRendering
)
VALUES (
@ModuleDefID,
'User Roles',
'User Roles',
'DesktopModules/Admin/Security/SecurityRoles.ascx',
'~/images/icon_securityroles_32px.gif',
1,
1
)
DELETE dbo.DesktopModules
WHERE ModuleName = 'User Accounts'
System.Data.SqlClient.SqlException: There is already an object named 'DF_Packages_IsSystemPackage' in the database.
Could not create constraint. See previous errors.
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)
/***********************************************************/
/* End Update Admin Modules to conform to Module Standards */
/***********************************************************/
/* Update Packages */
/*******************/
CREATE TABLE dbo.Tmp_Packages
(
PackageID int NOT NULL IDENTITY (1, 1),
PortalID int NULL,
Name nvarchar(50) NOT NULL,
FriendlyName nvarchar(250) NOT NULL,
[Description] nvarchar(2000) NULL,
PackageType nvarchar(50) NOT NULL,
[Version] nvarchar(50) NOT NULL,
License ntext NULL,
Manifest ntext NULL,
[Owner] nvarchar(100) NULL,
Organization nvarchar(100) NULL,
Url nvarchar(250) NULL,
Email nvarchar(100) NULL,
ReleaseNotes ntext NULL,
IsSystemPackage bit NOT NULL
)
ALTER TABLE dbo.Tmp_Packages ADD CONSTRAINT DF_Packages_IsSystemPackage DEFAULT 0 FOR IsSystemPackage
SET IDENTITY_INSERT dbo.Tmp_Packages ON
IF EXISTS(SELECT * FROM dbo.Packages)
EXEC('INSERT INTO dbo.Tmp_Packages (PackageID, Name, FriendlyName, Description, PackageType, Version, License, Manifest)
SELECT PackageID, Name, FriendlyName, Description, PackageType, Version, License, Manifest FROM dbo.Packages WITH (HOLDLOCK TABLOCKX)')
SET IDENTITY_INSERT dbo.Tmp_Packages OFF
ALTER TABLE dbo.Assemblies DROP CONSTRAINT FK_PackageAssemblies_PackageAssemblies
DROP TABLE dbo.Packages
EXECUTE sp_rename N'dbo.Tmp_Packages', N'Packages', 'OBJECT'
ALTER TABLE dbo.Packages ADD CONSTRAINT PK_Packages PRIMARY KEY CLUSTERED ( PackageID )
CREATE UNIQUE NONCLUSTERED INDEX IX_Packages ON Packages ( [Owner], Name, PackageType, PortalID )
ALTER TABLE dbo.Assemblies ADD CONSTRAINT FK_PackageAssemblies_PackageAssemblies FOREIGN KEY ( PackageID ) REFERENCES dbo.Packages ( PackageID ) ON UPDATE NO ACTION ON DELETE NO ACTION
System.Data.SqlClient.SqlException: Invalid column name 'PortalID'.
Invalid column name 'SkinRoot'.
Invalid column name 'SkinType'.
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)
/* Move Default Host Skins to HostSettings */
/*******************************************/
INSERT INTO dbo.HostSettings ( SettingName, SettingValue, SettingIsSecure )
SELECT 'DefaultAdminContainer', SkinSrc, 0 FROM dbo.Skins WHERE PortalID IS NULL AND SkinRoot='Containers' AND SkinType=1
INSERT INTO dbo.HostSettings ( SettingName, SettingValue, SettingIsSecure )
SELECT 'DefaultPortalContainer', SkinSrc, 0 FROM dbo.Skins WHERE PortalID IS NULL AND SkinRoot='Containers' AND SkinType=0
INSERT INTO dbo.HostSettings ( SettingName, SettingValue, SettingIsSecure )
SELECT 'DefaultAdminSkin', SkinSrc, 0 FROM dbo.Skins WHERE PortalID IS NULL AND SkinRoot='Skins' AND SkinType=1
INSERT INTO dbo.HostSettings ( SettingName, SettingValue, SettingIsSecure )
SELECT 'DefaultPortalSkin', SkinSrc, 0 FROM dbo.Skins WHERE PortalID IS NULL AND SkinRoot='Skins' AND SkinType=0
System.Data.SqlClient.SqlException: Invalid column name 'PortalID'.
Invalid column name 'SkinRoot'.
Invalid column name 'SkinType'.
Invalid column name 'PortalID'.
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)
/* Move Default Portal Skins to PortalSettings */
/***********************************************/
INSERT INTO dbo.PortalSettings (PortalID, SettingName, SettingValue)
SELECT
PortalID,
'DefaultAdminContainer' AS SettingName,
SkinSrc
FROM dbo.Skins
WHERE PortalID IS NOT NULL AND SkinRoot = N'Containers' AND SkinType = 1
INSERT INTO dbo.PortalSettings (PortalID, SettingName, SettingValue)
SELECT
PortalID,
'DefaultPortalContainer' AS SettingName,
SkinSrc
FROM dbo.Skins
WHERE PortalID IS NOT NULL AND SkinRoot = N'Containers' AND SkinType = 0
INSERT INTO dbo.PortalSettings (PortalID, SettingName, SettingValue)
SELECT
PortalID,
'DefaultAdminSkin' AS SettingName,
SkinSrc
FROM dbo.Skins
WHERE PortalID IS NOT NULL AND SkinRoot = N'Skins' AND SkinType = 1
INSERT INTO dbo.PortalSettings (PortalID, SettingName, SettingValue)
SELECT
PortalID,
'DefaultPortalSkin' AS SettingName,
SkinSrc
FROM dbo.Skins
WHERE PortalID IS NOT NULL AND SkinRoot = N'Skins' AND SkinType = 0
System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'IsWebSlice' in table 'dbo.TabModules' 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 WebSlice Properties to TabModules */
/*****************************************/
ALTER TABLE dbo.TabModules
ADD IsWebSlice bit NOT NULL CONSTRAINT DF_abModules_IsWebSlice DEFAULT 0
ALTER TABLE dbo.TabModules
ADD WebSliceTitle nvarchar(256) NULL
ALTER TABLE dbo.TabModules
ADD WebSliceExpiryDate datetime NULL
ALTER TABLE dbo.TabModules
ADD WebSliceTTL int NULL
System.Data.SqlClient.SqlException: 'PK_EventLogMaster' is not a constraint.
Could not drop constraint. See previous errors.
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 OobjectQualifier for PK_EventLogMaster */
/**********************************************/
ALTER TABLE dbo.EventLog
DROP CONSTRAINT PK_EventLogMaster
ALTER TABLE dbo.EventLog
ADD CONSTRAINT PK_EventLog PRIMARY KEY CLUSTERED ( LogGUID )
System.Data.SqlClient.SqlException: 'FK_EventLog_EventLogTypes' is not a constraint.
Could not drop constraint. See previous errors.
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 OobjectQualifier for PK_EventLogTypes */
/**********************************************/
ALTER TABLE dbo.EventLog
DROP CONSTRAINT FK_EventLog_EventLogTypes
ALTER TABLE dbo.EventLogConfig
DROP CONSTRAINT FK_EventLogConfig_EventLogTypes
ALTER TABLE dbo.EventLogTypes
DROP CONSTRAINT PK_EventLogTypes
ALTER TABLE dbo.EventLogTypes
ADD CONSTRAINT PK_EventLogTypes PRIMARY KEY CLUSTERED ( LogTypeKey )
ALTER TABLE dbo.EventLogConfig
ADD CONSTRAINT FK_EventLogConfig_EventLogTypes1 FOREIGN KEY ( LogTypeKey ) REFERENCES dbo.EventLogTypes ( LogTypeKey ) ON UPDATE NO ACTION ON DELETE NO ACTION
ALTER TABLE dbo.EventLog
ADD CONSTRAINT FK_EventLog_EventLogTypes1 FOREIGN KEY ( LogTypeKey ) REFERENCES dbo.EventLogTypes ( LogTypeKey ) ON UPDATE NO ACTION ON DELETE NO ACTION
System.Data.SqlClient.SqlException: Transaction (Process ID 1350) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
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 Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters)
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters)
at Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText)
at DotNetNuke.Data.SqlDataProvider.GrantStoredProceduresPermission(String Permission, String LoginOrRole)
if exists (select * from dbo.sysusers where name='coolcoolgame') begin declare @exec nvarchar(2000) declare @name varchar(150) declare sp_cursor cursor for select o.name as name from dbo.sysobjects o where ( OBJECTPROPERTY(o.id, N'IsProcedure') = 1 or OBJECTPROPERTY(o.id, N'IsExtendedProc') = 1 or OBJECTPROPERTY(o.id, N'IsReplProc') = 1 ) and OBJECTPROPERTY(o.id, N'IsMSShipped') = 0 and o.name not like N'#%%' and (left(o.name,len('')) = '' or left(o.name,7) = 'aspnet_') open sp_cursor fetch sp_cursor into @name while @@fetch_status >= 0 begin select @exec = 'grant EXECUTE on [' + @name + '] to [coolcoolgame]' execute (@exec) fetch sp_cursor into @name end deallocate sp_cursor end