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 |
fan2005
Yak Posting Veteran
85 Posts |
Posted - 2013-11-02 : 03:17:49
|
Hi,I need to know how a sp/udf can be shared across several Identical databases in same sever instance.SPs use tables ,global temptable using ## .and a solustion to call sp /udf and all issues with trigersOr I can even think about a solusion ( API or any command) to create / replcace sp/udf whith a neet solution in all DBs.thanks for your reply. |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-11-02 : 09:27:05
|
There is no facility in SQL Server that allows you to create a "global stored procedure" that has scope at the server level. A stored procedure belongs to a database. It is possible to access the stored procedure in one database from another database using the 3-part naming convention - the syntax is datbasename.schemaname.storedprocedurename. But even so, the stored procedure belongs to the database where it is created.You can create identical stored procedures in all databases - run the script on each database. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-02 : 13:14:58
|
are you asking about replication? if yes stored procedures can be replicated across databases.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
fan2005
Yak Posting Veteran
85 Posts |
Posted - 2013-11-03 : 08:25:09
|
quote: Originally posted by visakh16 are you asking about replication? if yes stored procedures can be replicated across databases.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
Is it Possible to just replicate sps and functions from one db to another. For example form operational db to test dbagain from operational db to another db (weeklydb) ,....where in test db we may have old version of the same sp.Thank you for your reply. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-03 : 09:16:35
|
quote: Originally posted by fan2005
quote: Originally posted by visakh16 are you asking about replication? if yes stored procedures can be replicated across databases.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
Is it Possible to just replicate sps and functions from one db to another. For example form operational db to test dbagain from operational db to another db (weeklydb) ,....where in test db we may have old version of the same sp.Thank you for your reply.
its possible to replicate it across dbs. But multiple versions of same sp cant coexist in any dbs. the latest version will overwrite existing one.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
ScottPletcher
Aged Yak Warrior
550 Posts |
Posted - 2013-11-04 : 15:52:28
|
For stored procedures, you can create a stored proc in the master db, with the name beginning with "sp_", mark it as a system object, and have it run in the context of any db from which it is called.I've never found any way to do that kind of thing for a function. |
|
|
fan2005
Yak Posting Veteran
85 Posts |
Posted - 2013-11-05 : 14:56:08
|
quote: Originally posted by visakh16
quote: Originally posted by fan2005
quote: Originally posted by visakh16 are you asking about replication? if yes stored procedures can be replicated across databases.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
Is it Possible to just replicate sps and functions from one db to another. For example form operational db to test dbagain from operational db to another db (weeklydb) ,....where in test db we may have old version of the same sp.Thank you for your reply.
its possible to replicate it across dbs. But multiple versions of same sp cant coexist in any dbs. the latest version will overwrite existing one.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
What about sps that are created after setting replication are they transfered to second server? |
|
|
|
|
|