Can I create create a global function in SQL Server?

前端 未结 2 674
醉梦人生
醉梦人生 2021-01-05 10:13

Is it possible to create a function in SQL Server which I could use in any database on the server, without adding the database prefix?

For example, with this functio

2条回答
  •  忘掉有多难
    2021-01-05 10:40

    Although creating stored procedures in master makes them globally available, this does not work for functions. You need to use the three-part naming convention:

    select ..getDays(...)
    

    Why would Microsoft make functions different from stored procedures?

提交回复
热议问题