获取数据表列相关数据
虽然本人在开发数据库时,不太使用视图,但是还是知道
如何获取视图中使用的所有表列:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
SELECT * FROM INFORMATION_SCHEMA.VIEW_COLUMN_USAGE
如何获取包含视图所有表:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
SELECT * FROM INFORMATION_SCHEMA.VIEW_TABLE_USAGE
获取包含有任何约束的所有列:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
获取表列的信息:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME='table_name'