deepeshdhake (10/1/2012)
Hello,I have wrote one store proc. So, in the stored procedure, it is using one table which is in the different database. When I am trying to execute the stored proc it is giving me this error "INVALID OBJECT NAME". I have also given the permission to the stored proc.
Following is the sample stored proc:
create proc proc_name(inputs)
AS
BEGIN
select x.id,y.name
FROM dbo.X_name x inner join dbname.dbo.Y_name y ON x.is=y.id
END
ERROR: Invalid Object Name 'dbname.dbo.Y_name'
NOTE: I got this error when I altered the procedure. Before it was running properly.
Run these two queries and post back the results.
Query 1
select TOP 10 x.id,y.name
FROM dbo.X_name x inner join dbname.dbo.Y_name y ON x.is=y.id
Query 2
select TOP 10 * FROM dbname.dbo.Y_name
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden