Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2009-03-13 : 02:44:14
|
Hi,I need to access objects(say like tables,procedures etc..) across Database within the server.For this i have create one test procedure under master database.but still iam not able to execute the procedure from different database.Could anyone correct me if iam wrong? |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2009-03-13 : 02:54:40
|
| could u post what u have done |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2009-03-13 : 03:58:23
|
use MasterGoCreate Procedure Testasbeginset nocount onselect 'Hello' as output1set nocount offendgo use Fin_Wh --Databasegoexec dbo.TestError thrown:Msg 2812, Level 16, State 62, Line 1Could not find stored procedure 'test'quote: Originally posted by shaggy could u post what u have done
|
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-03-13 : 04:02:13
|
There is nothing like a "path" to access an object from whereever you want.You need to access objects within one server via Databasename.Schemaname.Objectname.Example select * from DB1.dbo.Table1And don't spam the master database.GreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2009-03-13 : 04:23:51
|
ok.please confirm whether only system related objects can be accessed across database.quote: Originally posted by webfred There is nothing like a "path" to access an object from whereever you want.You need to access objects within one server via Databasename.Schemaname.Objectname.Example select * from DB1.dbo.Table1And don't spam the master database.GreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die.
|
 |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2009-03-13 : 04:48:57
|
| use MasterGoCreate Procedure Testasbeginset nocount onselect 'Hello' as output1set nocount offendgo use Fin_Wh --Databasegoexec master.dbo.Testprocedure with prefix as sp_ which is created on master can be accessed across server |
 |
|
|
|
|
|