SQLServerCentral Editorial

The Information Schema and Cross-RDBMS Working

,

I frequently give thanks for ODBC (Open Database Connectivity). It basically makes any data source, even a directory of text files, into a SQL database. It solves a lot of problems effortlessly. It may seem rather aged technology, but if you've got a good set of drivers, and some ODBC tools, then you have little to fear from the chore of extracting data.

I wish I could be as positive about the information schema. Like ODBC, the information schema was intended to help with cross-RDBMS (Relational Database Management System) issues. Once you have a connection to a relational database, the information schema, which is part of the SQL standard, should allow any process to understand what metadata is there. You should be able to see the tables and routines, browse constraints, keys and indexes. It makes sense to check what's there as part of an automated process, and you end up with more resilient or idempotent code if you can reliably use it. It also helps with any scripting that needs to work in different SQL environments. It is also satisfying to be able to be productive with any database with little more than a connection and a basic query window.

The problem is that there is little motivation for the vendors of RDBMS to implement that part of the standard. It doesn't sell licences. DB2, SQLite, and Oracle ignore the standard altogether - though SQLite has the excuse of being embedded rather than server-based. SQL Server started to implement it but then lost interest. MySql has a rather non-standard version, and only PostgreSQL have made the effort to do it properly.

If you never have to emerge from under SQL Server's cosy environment, all this will seem rather academic. the metadata views and functions are excellent, and will provide a vast amount of information, more than enough for most requirements. Where you are confident that you never need to stray to other RDBMS, there is no need to worry about the information schema, but once you start having code that is using several RDBMSs, or have to flit between them, it becomes a nuisance to be stuck with a range of standard-compliance that ranges from the good to the non-existent.

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating