View Single Post
Old 01-10-2007, 10:30 AM   #52
ipimienta
New Member
 
Join Date: Jan 2007
Model: 8700
Posts: 1
Default

Here is the content of 103302.sql


/*+---------------------------------------------------------------------------
* Support Script: 4.1.2 Upgrade failure
* Created: 09/18/2006
* Tracked via : SDR103302
* Description: This script will fix the error in upgrading your database for the following failure:
* [10000] (09/13 23:14:07.682):{0x1878} SQL Error Message from CBESDBInstaller::ExecuteSql.executeDirect: SQLSTATE: 42000 Native error: 3725 Message: The constraint 'PK_MDSConfig' is being referenced by table ' ', foreign key constraint 'FK_RelationSCMDS_MDSConfig'.
* [10000] (09/13 23:14:07.682):{0x1878} SQL Error Message from CBESDBInstaller::ExecuteSql.executeDirect: SQLSTATE: 42000 Native error: 3727 Message: Could not drop constraint. See previous errors.
*
* Instructions for running script:
* 1. Backup database
* 2. Paste the following code into Query Analyzer
* 3. Select your BESMgmt Database and then run the code
*+--------------------------------------------------------------------------*/

/* it is possible there may be a 4.1.2 Version row in ServerDBVersion Table */
delete from ServerDBVersion where CurrentVersion = '4.1.2'
go

/* it is possible there may be orphaned MDSConfig rows so let's get rid of them */
delete from MDSConfig where serverconfigid is null
go

/* Drop objects in case this is a rerun to avoid problem dropping PK_MDSConfig */
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'RelationSCMDS' AND type = 'U')
begin
drop TABLE dbo.RelationSCMDS
end
go

if exists (select name from sysobjects where name = 'PK_MDSminuteStat' and xtype = 'PK')
begin
alter table MDSminuteStat drop constraint PK_MDSminuteStat
end
go

if exists (select name from sysobjects where name = 'FK_MDSminuteStat_MDSConfigId' and xtype = 'F')
begin
alter table MDSminuteStat drop CONSTRAINT FK_MDSminuteStat_MDSConfigId
end
go

if not exists (select name from sysobjects where name = 'PK_MDSminuteStat' and xtype = 'PK')
begin
ALTER TABLE MDSminuteStat WITH NOCHECK ADD
CONSTRAINT PK_MDSminuteStat PRIMARY KEY CLUSTERED (Id)
end
go
Offline