CREATE TABLE #temp
(FName VARCHAR(10),
LName VARCHAR(10),
FullName VARCHAR(21) DEFAULT(FName+' '+LName)
);
When I try the above statement I am getting the following error. Is there any workaround available for this?
Msg 128, Level 15, State 1, Line 1 The name "FName" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
FullNameto always beFName + ' ' + LName, then make it a computed column. Or you only want to set an initial value, then use a before-insert trigger.