糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > 判断字段是否存在 判断主键是否存在 判断某个字段是否具有not null约束

判断字段是否存在 判断主键是否存在 判断某个字段是否具有not null约束

时间:2023-10-03 13:12:55

相关推荐

判断字段是否存在 判断主键是否存在 判断某个字段是否具有not null约束

判断字段是否存在:if not exists(select * from syscolumns where id=object_id('temphlxf') and name='czy') beginalter table temphlxf add czy varchar(50) not nullendGO判断主键是否存在:IF EXISTS (select * from sysobjects where parent_obj=object_id(N'temphlxf') and name='pk_temphlxf' and xtype='PK')BEGINALTER TABLE temphlxf drop Constraint pk_temphlxfENDGO判断某个字段是否具有not null约束:if exists (select * from syscolumns where id = OBJECT_ID('temphlxf') and name = 'czy' and isnullable=1)beginalter table temphlxf alter column czy varchar(50) not nullend GO

如果觉得《判断字段是否存在 判断主键是否存在 判断某个字段是否具有not null约束》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。