I have a DEFAULT constraint created in the database, which I want to share among several tables, and I want to script an unique alter table statement for adding a field in that tables as follows:
ALTER TABLE MyTable ADD MyField NOT NULL DEFAULT(DF_EXISTING_DEFAULT)
The following error ocurrs:
Msg 128, Level 15, State 1, Line 1
The name "DF_EXISTING_DEFAULT" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
Notice that the default value is already defined in DF_EXISTING_DEFAULT, I don't want to write it again. How can I do it? Any reason I shouldn't do it? Is it a t-sql limitation?