Groups | Blog | Home
all groups > sql server programming > june 2004 >

sql server programming : invalid object name when executing stored procedure


mj
6/26/2004 4:04:27 PM
hi. new to sql server here. thanks for any help. i have an
update query that i'm trying to execute from query
analyzer and it's giving me an error:

Procedure UpdateAccountsTerritoryID, Line 3
Invalid object name 'accounts'.

"accounts" is definately the name of the table. here's the
thing..."accounts" is a table that was created by someone
else and its owner is SalesEndoSQLUser. The table called
AccountsAssignedTerrID that I imported is owned by
EndoSQLUser...


the sp is looks up is just updating the territory that
each account is in. AccountsAssignedTerrID is a table we
have to import everyday from someone elses database. it's
two columns (AccountID, TerritoryID):

CREATE PROCEDURE [UpdateAccountsTerritoryID]

AS UPDATE accounts

SET accounts.[territory_id] =
AccountsAssignedTerrID.TerritoryID
FROM accounts, AccountsAssignedTerrID

WHERE
accounts.[account_id] = AccountsAssignedTerrID.AccountID
mj
6/26/2004 6:22:45 PM
Right on! Thanks, Steve!

[quoted text, click to view]
Steve Kass
6/26/2004 7:58:22 PM
Have you tried specifying the owner of accounts?

update SalesEndoSQLUser.accounts
set ...
from SalesEndoSQLUser.accounts, ...

Steve Kass
Drew University

[quoted text, click to view]
AddThis Social Bookmark Button