1
create  table Names (
   FirstName  varchar(40),
   LastName  varchar(40),
   FullName  AS FirstName+LastName
)

but now, in the full name i want that a space is inserted between first and last name, so i am altering the table but it gives syntax error. how to alter it.

alter table Names
alter column fullname as FirstName+' '+LastName

2 Answers 2

4

You can do this instead:

alter table Names drop column fullname 
alter table Names add fullname as FirstName+' '+LastName 
Sign up to request clarification or add additional context in comments.

1 Comment

+1 Looking at ALTER TABLE .. ALTER COLUMN in BOL I think this is the only way. <computed_column_definition> only appears under ADD
2

You can not ALTER computed columns. You can drop and recreate

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.