Is it possible to add default constraint with synonym or UDF from other database?
Create table TestTable ( ID int identity(1,1), SData varchar(100), UserName varchar(100) default [OtherDatabaseName].dbo.fn_Test('value')) Below is the error message, while I am trying to add default constraint
The name "OtherDatabaseName" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
We can add UDF from same database but I want add UDF from other database. Because it is used in multiple databases on same server.
And I do not want to create that UDF in all database and prevent duplicate code.
Please let me know if there is any other/better way. Thank you.