开发者

altering a table column

开发者 https://www.devze.com 2023-02-19 09:02 出处:网络
createtable Names ( FirstNamevarchar(40), LastNamevarchar(40), FullNameAS FirstName+开发者_StackOverflowLastName
create  table Names (
   FirstName  varchar(40),
   LastName  varchar(40),
   FullName  AS FirstName+开发者_StackOverflowLastName
)

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


You can do this instead:

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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消