KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How to add a column to a SQL Server table with a default value that is equal to value of an existing column? I tried this T-SQL statement: ALTER TABLE tablename ADD newcolumn type NOT NULL DEFAULT (oldcolumn) but it's giving an error: The name "oldcolumn" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
Tags (comma-separated)
Save Edits
Cancel