标签:src sql hid splay event inf for foreign one
从下面2句SQL语句执行来看,
SELECT * FROM sys.tables WHERE OBJECTPROPERTY(OBJECT_ID,‘TableHasPrimaryKey‘) <> 0 SELECT * FROM sys.tables WHERE OBJECTPROPERTY(OBJECT_ID,‘TableHasForeignKey‘) <> 0
就知道那一张表有主键PrimaryKey或ForeignKey。
比如,表[Q]和[QQ]既没有主键,也没有外键。
当在SQL语句的条件中,使用“=”,那说明查询出来的结果是否,即是不包含主键或外键。
SELECT * FROM sys.tables WHERE OBJECTPROPERTY(OBJECT_ID,‘TableHasPrimaryKey‘) = 0 SELECT * FROM sys.tables WHERE OBJECTPROPERTY(OBJECT_ID,‘TableHasForeignKey‘) = 0
使用TableHasPrimaryKey或TableHasForeignKey来知道表是否有主键或外键
标签:src sql hid splay event inf for foreign one
原文地址:https://www.cnblogs.com/insus/p/12108649.html