User Defined Function (UDF) in master database

  • I have a function which is used in more than dozen of databases. So I want this function to be accessible in all the databases by writing it only once, so I want to write the function in master database so that my function can be accessed easily.

    So my question is, is there any problem in writing the user defined function in master db?

    And when surfing the internet some had suggested converting function to system function. (Using “EXEC sp_ms_marksystemobject 'fn_db_name' ”).

    Is there a necessity to convert the function created in master db to system function? If yes why?

    Please guide me.

  • I would not make it a system function. In general if I have something I want available to all, just putting it in master is a good enough approach. there's no need to do more under most circumstances.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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