转:http://www.cnblogs.com/pangpanghuan/p/6432331.html Sql Server 增加字段.修改字段.修改类型.修改默认值 1.修改字段名: alter table 表名 rename column A to B 2.修改字段类型: alter table 表名 alter column 字段名 type not null 3.修改字段默认值 alter table 表名 add default (0) for 字段名 with values 如果字…
sql语句修改字段长度 alter table <表名> alter column <字段名> 新类型名(长度) 例: alter table students alter column PhotoEnterSchool nvarchar(500) alter table students alter column PhotoGraduate nvarchar(500)…
SQL Server为字段添加默认值 if not exists ( select * from sys.columns as c join sys.objects as o on c.default_object_id = o.[object_id] where c.[object_id] = object_id('DriverTable') and c.name = 'DriverVan' ) begin alter table DriverTable add default(0) for…