Msg 128, Level 15, State 1, Line 5
The name “%.*s” is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
This error message appears when you try to use an object name in an invalid context.
The T-SQL statement can be parsed, but causes the error at runtime.
Error of the Severity level 15 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed. Parameters must be passed in a unified format. Each objectname must be used in a valid context for this object type.
All versions of SQL Server.
IF OBJECT_ID(‘tempdb..#t’) > 0
DROP TABLE #t
CREATE TABLE #t
id CHAR(10) NULL,
CONSTRAINT df_working DEFAULT (c1 = id + ‘ Hello World’)
In the above example we try to use the column name c1 in the invalid context of the DEFAULT constraint. This raises the error.