sql 修改字段

 

 create table messages(
     id int not null identity,
  
)

 select * from messages

  alter table messages add [user] nvarchar(max)  --增加字段
  alter table  messages add msg text not null  -- 增加字段
  alter table  messages add [time] int not null  -- 增加字段
   
  alter table messages drop column  [time] --删除字段

  alter table messages alter column msg nvarchar(max) -- 修改字段类型
   alter table messages alter column msg int   
  -- 开始直接从text 类型修改为int 不能修改 不知道为什么
    
  

  

原文地址:https://www.cnblogs.com/chenxiao/p/2752320.html