Create a system function, in the same manner as a system stored procedure?

  • Hi All,

    I recently wrote a blog post on creating a CLR function to use .NET RegEx for matching and replacing in strings.[/url] I'm looking at implementing this across our server base, but as it's a function, this would mean creating the assembly and function in every database; this isn't particularly maintainable.

    I've tried using sys.sp_MS_marksystemobject but this doesn't seem to work for functions. I've also tried the solution in this article, but this doesn't work for 2012.

    One possible solution is creating a "SharedFunctions" database, and then creating synonyms in all other databases to point to that db, but it's a bit ugly and also means that permissions always have to be granted on the central db.

    Is it possible to create a system function?

    Cheers

    Matthew

    Follow me on twitter @EvoDBACheck out my blog Natural Selection DBA[/url]

  • A shared database where the guest user is granted execute permission to your function will be a clean solution transparent to all logins in the instance, even new ones. Synonyms in all other databases can abstract the shared database.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Yeah, looks like that might be the only solution. Seems a bit ugly; but hey ho.

    Follow me on twitter @EvoDBACheck out my blog Natural Selection DBA[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply