Wednesday, March 21, 2012

Invalid object name

Hi,

I have two tables in differents databases : Master database : ServerInformation where there is a table called "Clientes" and Table "Documentos" in the Database Index2003

What I need to do via Trigger is update the table "Documentos" in the field "Cliente" everytime the "Clientes" table change the field 'Cliente'.

Im using the follow Trigger

CREATE TRIGGER UPDate_Documentos_Index2003 ON dbo.Clientes
FOR UPDATE
AS

UPDATE [dbo].[Index2003].[Documentos]
SET [dbo].[Index2003].[Documentos].Cliente = i.Cliente
FROM Inserted i
INNER JOIN [dbo].[Index2003].[Documentos] D
ON D.ID_Clientes = i.ID_Clientes

When I commit the change in the register "Clientes" arise the follow message :

Invalid object name 'dbo.Index2003.Documentos'

Have I doing something wrong ?

Thanks for attetion

Leonardo AlmeidaOriginally posted by vectords
Hi,

I have two tables in differents databases : Master database : ServerInformation where there is a table called "Clientes" and Table "Documentos" in the Database Index2003

What I need to do via Trigger is update the table "Documentos" in the field "Cliente" everytime the "Clientes" table change the field 'Cliente'.

Im using the follow Trigger

CREATE TRIGGER UPDate_Documentos_Index2003 ON dbo.Clientes
FOR UPDATE
AS

UPDATE [dbo].[Index2003].[Documentos]
SET [dbo].[Index2003].[Documentos].Cliente = i.Cliente
FROM Inserted i
INNER JOIN [dbo].[Index2003].[Documentos] D
ON D.ID_Clientes = i.ID_Clientes

When I commit the change in the register "Clientes" arise the follow message :

Invalid object name 'dbo.Index2003.Documentos'

Have I doing something wrong ?

Thanks for attetion

Leonardo Almeida

Nice try ;)

If you did not linked server - do it.

BOL: Use Accessing Linked Servers
After a linked server is created using sp_addlinkedserver, it can be accessed using:
Distributed queries. Accessing tables in the linked server through SELECT, INSERT, UPDATE, and DELETE statements using a linked server-based name (server.database.dbowner.object).|||More simply, you just qualified your table incorrectly. It should be

[Index2003].[dbo].[Documentos]

No comments:

Post a Comment