473,378 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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'.

I´m 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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
2 17605
Try this (untested):

CREATE TRIGGER UPDate_Documentos_Index2003 ON dbo.Clientes FOR UPDATE
AS

UPDATE [Index2003].[dbo].[Documentos]
SET Cliente =
(SELECT Cliente
FROM inserted
WHERE ID_Clientes =
[Index2003].[dbo].[Documentos].ID_Clientes)
WHERE ID_Clientes
IN (SELECT ID_Clientes FROM inserted)

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #2
Leonardo Almeida (le*****************@yahoo.com.br) writes:
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'


You have swapped database name and ownername. Use Index2003..Documentos
instead.

Also, in the left-hand side of the SET-clause, you should use any
prefix at all.

--
Erland Sommarskog, SQL Server MVP, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rockie12 | last post by:
I have a db that has a table x in it called data1 I have a program that does to things, updates values in the data1 table and also inserts new rows into this table. The update existing values...
10
by: FreeOperator | last post by:
Dear all, On Win2000 server with SP3, I am trying to access a SQL Server 7.0 database, "TestDB", from VB6 via a SQL Server ODBC system DSN using ADO 2.7. In SQL Server Enterprise Manager, there...
1
by: Frank Py | last post by:
I'm getting the following error when trying an example app: Invalid object name 'Products'. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'Products'. Line 22:...
3
by: Mr.KisS | last post by:
Hello all, I'm working with : WinXP PRO SP1, MS SQL 2005 Express, Visual Web Dev 2005 Express. I have an aspx page which must execute a stored procedure : ______________ try {...
2
by: Jerry Nelson | last post by:
I get the following error: WGA_Update is a view not a Table Invalid object name 'WGA_Update'. Description: An unhandled exception occurred during the execution of the current web request....
2
by: Adrien Reboisson | last post by:
I'm trying to build a basic DB explorer using C# & Visual Studio 2005. I installed SQL Server 2005 Express, created a blank project, dropped a TreeView, a ListView and a DataGridView : DB objects...
3
by: ianforgroupuse | last post by:
I'm running Vista Business edition on 2005 Virtual PC. Installed SQL Server 2005 Express latest download, with instance of MSSQLSERVER and service accounts running under "NT AUTHORITY\SYSTEM"....
1
by: moni | last post by:
Hi, I am using a table named PersonInfo in my database monisha in the SQL server. I need to use this in a .aspx file , but its giving me the error of invalid object name. <asp:SqlDataSource...
4
by: Curious | last post by:
I got an exception when executing the SQL statement in my code below. The error is "Invalid object name 'db_dynamic_trading.dbo.TrdRpt_broker_list'". I know for a fact that...
8
by: dougancil | last post by:
I have the following query: insert into msbtotal.dbo.newclients SELECT distinct tcms_members.dbo.memberdata2.* FROM tcms_members.dbo.memberdata2 left outer join msbtotal.dbo.memberdata on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.