I need a list of functions that can be invoked in a Default Value or Binding column.
Where can I find them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DEFAULT constraints can be any ‘system function’ or a literal:
The term ‘system function’ is a bit ambiguous. None the less, there is a list of system built-in functions at Built-in Functions (Transact-SQL). For DEFAULT constraints only scalar functions are supported, and the MSDN separates scalar function into topics, but it obviously fails to follow trough with this separation as for instance Scalar Functions lists all ‘System Statistical Functions‘ and the later lists
fn_virtualfilestatswhich is obviously not scalar. Also certain functions cannot be used in any context and will not be possible to be used as DEFAULT constraint, eg.IDENTITY(the less known function, not the well known column property).Although one can apparently write a short novel about what system functions can and what cannot be used as a DEFAULT constraint, in practice there is only a small handfull of functions that make sense to be used, like
GETDATE(),ORIGINAL_LOGIN(),NEWID()andNEWSEQUENTIALID(). Just to end on a high note, the latter is rather interesting as is a function that can be used only in a DEFAULT constraint.