SQL中取得表中主键或其它信息
SQL中取得表中主键或其它信息
取得表中主键:
select primaryKey=COLUMN_NAME from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
WHERE CONSTRAINT_NAME=(select CONSTRAINT_NAME from
INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_TYPE=’PRIMARY KEY’ AND TABLE_NAME=’表名’)
取得表的其它有用信息: select * from INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
SQL中取得表中主键或其它信息
https://www.dearcloud.cn/2013/04/19/20200310-cnblogs-old-posts/20130419-SQL中取得表中主键或其它信息/