sql动态添加字段

if exists(select * from syscolumns where id=object_id('bairong_Users') and name='JxsShow') 
begin
--alter table bairong_Users drop column Token  --删除字段
print '已存在'
end
else
begin
alter table bairong_Users add JxsShow nvarchar(255) null
update [dbo].[bairong_Users] set JxsShow = 'Y'

end



修改字段


ALTER TABLE [USER] ALTER COLUMN [NAME] VARCHAR(35) NULL 

你可能感兴趣的:(sql动态添加字段)