all groups > sql server mseq > september 2005 >
You're in the

sql server mseq

group:

How to call talbe/SP from Linked server with out database and user


How to call talbe/SP from Linked server with out database and user Rajesha
9/14/2005 7:57:08 AM
sql server mseq:
Dear Friends,
Usually we call tabal and SP like given below.
select * from [linkedserver].[database].[dbo].[TableName]
EXEC [linkedserver].[database].[dbo].usp_storedprocedure
but I like to all with out database and username.
I tryed like below
select * from [linkedserver]...[TableName]
OR
select * from [linkedserver]..[user].[TableName]

It's gives error

Server: Msg 7313, Level 16, State 1, Line 1
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog
specified for the provider.].

Please help me to achive this.

Thasks and regards,

Re: How to call talbe/SP from Linked server with out database and Rajesha
9/15/2005 10:05:01 PM
Dear Kornelis,
Thanks for your responce.
I would like to say that, while configuring linked server there will be an
option to specify catelog(DatabaseName). I think there is as chance, we can
get.
as of know below query

As you told with out user there is chance to work but , I tryed that I
getting error.

select * from [linkedserver].[database]..[TableName]

gives below error.

Server: Msg 7313, Level 16, State 1, Line 1
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog
specified for the provider.].

Thanks and Regards,
Rajesh


[quoted text, click to view]
Re: How to call talbe/SP from Linked server with out database and user Hugo Kornelis
9/15/2005 10:06:17 PM
[quoted text, click to view]

Hi Rajesh,

You can't leave out the databasename. A linked server might hold more
than one database, so you have to specify that part.

I believe that you can leave out the owner, but I'm not sure, and I
can't test that right now. However, it is recommended that you always
include the owner. This helps SQL Server find the object more quickly,
and it helps reduce the number of recompiles.

Best, Hugo
--

Re: How to call talbe/SP from Linked server with out database and Hugo Kornelis
9/16/2005 9:37:38 PM
[quoted text, click to view]

Hi Rajesh,

Thanks for testing this, and posting back with the results.

So I guess that the answer to your original question is that this can't
be done - you must specify all four parts if you reference objects on a
linked server.

Best, Hugo
--

AddThis Social Bookmark Button