Last post May 25, 2020 02:10 PM by msdevm
Apr 30, 2020 05:21 PM|msdevm|LINK
Hi Guys, Is there a way to create a global function with full permission to be used with all database in the sql server?
I have couple of functions that I use with all my databases and instead of creating the function in all databases, I would create it in the master database instead and use the function with all other database created in the server with fully permission
Function GetPersonAge(dob datatime) - Returns the accurate age of the person, what I mean by accurate is that is the person is not within the birthday month and day or passed the birthday month then age is not real.
I tried the creating the function in the master database, but when I want to use it in one of databases created I get an error message no permission to access GetPersonAge()
So my question is, Is there a way to make the function global like one out of the box in SQL and just use it, or I always have to set permission to the function in the master database to the user or the other database?
May 01, 2020 01:15 AM|ryanbesko|LINK
First off, this would only be possible on a server under your control, as a web application would not be able to access the master db in a shared hosting environment.
I don't recommend it, but if it's your server, add the same user account to the master db that is accessing your application db, maybe?
May 25, 2020 02:10 PM|msdevm|LINK
Thank you ryanbesko for your reply, I was 90% certain that this was possible unless you have full control of sql server, I thought that with the newest version of SQL server this could be possible or maybe there was a way to get away with it.