Error Message:
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.
Severity level:
15.
Description:
This error message appears when you try to use an object name in an invalid context.
Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.
Resolution:
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.
Versions:
All versions of SQL Server.
Example(s):
USE tempdb;
GO
IF OBJECT_ID(‘tempdb..#t’) > 0
DROP TABLE #t
GO
CREATE TABLE #t
(
id CHAR(10) NULL,
c1 TEXT
CONSTRAINT df_working DEFAULT (c1 = id + ‘ Hello World’)
)
GO
Remarks:
In the above example we try to use the column name c1 in the invalid context of the DEFAULT constraint. This raises the error.