Querying database schema of SQL Server DB via ODBC?

吃可爱长大的小学妹 提交于 2019-12-06 04:30:57

Query against the INFORMATION_SCHEMA views. Beautiful thing about using information schema is that it's a standard so it should be portable to any database that has implemented the standard.

e.g. SELECT * FROM INFORMATION_SCHEMA.COLUMNS ISC

The standard is the SQL-92 Starts at page 535

If you want to get a list of the schema's in the database, you can use the wildcard in the SQLTables call

SQLTables( stmt, NULL, 0, "%", SQL_NTS, NULL, 0, NULL, 0 );

Or something close to that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!