你的位置:首页 > 数据库

[数据库]SQL如何增删修改字段


1: 新增字段:

ALTER TABLE [Business].[LandInfo] Add LandFormalitiesSituation NVARCHAR(200) NULLEXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'土地手续办理情况' , @level0type=N'SCHEMA',@level0name=N'Business', @level1type=N'TABLE',@level1name=N'LandInfo', @level2type=N'COLUMN',@level2name=N'LandFormalitiesSituation'

2:删除字段:

ALTER TABLE [Business].ProjectInfo DROP COLUMN ConstructionSituation

3:修改字段名:

EXEC sp_rename 'Business.ProjectImageInfo.ProjectInfoCode','ResourceID','COLUMN'

4:修改字段类型:

ALTER TABLE Business.LandNature ALTER COLUMN Creator NVARCHAR(64)