SQL - SQL Error

   
Vista:

SQL Error

Publicado por Mario Ivan (1 intervención) el 06/05/2010 13:30:10
Ayuda, Help al realizar erl upgrade para la migracion de una base de datos manda el siguiente error
ACTION NAME: Loading Table

'SYNCHROFILTER'
ACTION DESCRIPTION: This statement loads

table 'SYNCHROFILTER'.
ACTION RUNTIME: 5/6/2010 5:24:47 AM
ACTION FAILED: TRUE
ACTION ERROR INFORMATION: ERROR(-

2147217865): Invalid object name

'SYNCHROFILTER'.(SQLText=

DECLARE @Column AS NVARCHAR(50),

@SQL AS NVARCHAR(4000),

@LocationCode AS

NVARCHAR(8)

SELECT

@LocationCode =

POS.dbo.udfGetDefaultLocationCode()


--BUILD

A TEMP TABLE TO HOLD OUR DATA

SELECT TOP 1 *

INTO #SYNCHROFILTER

FROM [SYNCHROFILTER] (NOLOCK)


--EMPTY

THE TEMP TABLE OUT

DELETE FROM #SYNCHROFILTER

--LOAD THE TEMP

TABLE
BULK INSERT

#SYNCHROFILTER FROM 'C:\Program Files

\Dominos\Pulse\DBUpgrade

\HISTORYReplaceData\SYNCHROFILTER.dat'

WITH (

FORMATFILE='C:\Program

Files\Dominos\Pulse\DBUpgrade

\HISTORYReplaceData\SYNCHROFILTER.fmt'

)


--CHANGE _LOC_ TO THE LOCATION CODE FOR

DATA IN THE TEMP TABLE

DECLARE ColumnList CURSOR LOCAL

FOR SELECT C.[Name]

FROM

syscolumns AS C (NOLOCK),

sysobjects AS O

(NOLOCK)

WHERE C.[Name] LIKE '%Location_Code%'

AND C.

[ID] = O.[ID]

AND O.[NAME] = 'SYNCHROFILTER'



OPEN ColumnList


FETCH ColumnList INTO

@Column


SET @SQL = ''
WHILE

@@FETCH_STATUS = 0

BEGIN


SET @SQL = @SQL + ' UPDATE

#SYNCHROFILTER SET [' + @Column + '] =

''' + @LocationCode + ''' WHERE [' +

@Column + '] = ''_LOC_'' '

FETCH ColumnList INTO @Column



EXECUTE (@SQL)


END


CLOSE ColumnList

DEALLOCATE ColumnList




IF 0 = 0

BEGIN

--CLEAR

THE TABLE AND LOAD IT

DELETE FROM [SYNCHROFILTER]

INSERT

INTO [SYNCHROFILTER]

SELECT *

FROM #SYNCHROFILTER


END

ELSE
BEGIN



--INSERT THE ROWS THAT DON'T ALREADY

HAVE A PRIMARY KEY MATCH

SET @SQL = 'INSERT INTO

[SYNCHROFILTER] SELECT T.* FROM

#SYNCHROFILTER AS T ' +

'LEFT OUTER JOIN

[SYNCHROFILTER] AS R (NOLOCK) ON '



CREATE TABLE #PKeys

(

TABLE_QUALIFIER sysname,


TABLE_OWNER sysname,

TABLE_NAME sysname,

COLUMN_NAME sysname,

KEY_SEQ

smallint,

PK_NAME sysname

)


INSERT INTO #PKeys

EXECUTE sp_Pkeys 'SYNCHROFILTER'



DECLARE PKeys CURSOR LOCAL

FOR SELECT CONVERT

(NVARCHAR(50), COLUMN_NAME)

FROM #PKeys



OPEN PKeys


FETCH PKeys INTO @Column



WHILE @@FETCH_STATUS = 0

BEGIN


IF RIGHT(@SQL, 4) <> ' ON '

SET @SQL = @SQL

+ ' AND '



SET @SQL = @SQL + 'R.[' + @Column + '] =

T.[' + @Column + ']'



FETCH PKeys INTO @Column


END


SET @SQL = @SQL

+ ' WHERE R.[' + @Column + '] IS NULL '



CLOSE PKeys


IF 0 = 1

BEGIN


SET @SQL

= @SQL + 'DELETE FROM [SYNCHROFILTER]

WHERE NOT EXISTS ( '

+ 'SELECT * FROM

#SYNCHROFILTER WHERE '


OPEN PKeys


FETCH PKeys INTO @Column


WHILE

@@FETCH_STATUS = 0

BEGIN


IF RIGHT(@SQL, 7) <> '

WHERE '

SET @SQL = @SQL + ' AND '



SET @SQL = @SQL +

'[SYNCHROFILTER].[' + @Column + '] =

#SYNCHROFILTER.[' + @Column + ']'


FETCH PKeys INTO

@Column


END



SET @SQL = @SQL + ')'


CLOSE PKeys


END


DEALLOCATE PKeys

EXECUTE (@SQL)



DROP TABLE #Pkeys


END


DROP

TABLE #SYNCHROFILTER)

en una de las tablas

se le corrio el siguiente script para intentar corregirlo

--run the following against history, and try the upgrade again
--
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[SYNCHROFILTER]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[SYNCHROFILTER]
GO
CREATE TABLE [dbo].[SYNCHROFILTER] (
[TABLENAME] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PARENT] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[FILTER] [varchar] (254) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
CONSTRAINT [PK_SYNCHROFILTER] PRIMARY KEY CLUSTERED
(
[TABLENAME],
[PARENT]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
GO

pero sigue mandando el mismo error podria alguien orientarme como corregirlo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder