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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 access across database

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-03-10 : 19:51:04
My server name: server1
database: database1,database2 and so on..

my requirement is i need to access GenerateScript object across database

I have created one GenerateScript stored procedure under master
database..
while iam using database1 (ie)

use database1
exec GenerateScript Table1
Go

the below error is thrown
Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'GenerateScript'.


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-03-11 : 00:10:51
use database1
exec master.dbo.GenerateScript Table1
Go

But you'll need to rewrite GenerateScript stored procedure so that it can handle any database.


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -