[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

UDF available to many databases

I have a sql function which I would like many databases to have access to.  
What is the best way to do this?  Will putting the function in the Master database make it available to all other databases?

  • 2
1 Solution
It's available to other databases regardless of which database it is stored in. Personally, I would NOT put it in master just because that is a system database that I don't like to alter.  

I know this is not what you want to hear, but if the function is NOT application specific, then I would probably follow microsoft's precedcent and put a copy in every database to facilitate portability.  Or at least I would put a synonym for it in every database.  Then things won't go haywire when you start moving databases around.  You can put the original in the model database to facilitate distribution.

If the function is application specific, then I would put it on every database for that application.  Create a synonym for it on every other database that needs to access it.
KimberleyYAuthor Commented:
How do you know what I want to hear? ;>) Thanks this answer was just fine.  

Thanks for you help!

>How do you know what I want to hear?

The same way you can "hear" what I've  typed?

Good luck

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now