Problem Solving With Information Schema Columns

  • IsaacGoGo

    SSC Eights!

    Points: 944

    Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/jsack/problemsolvingwithinformationschemacolumns.asp

  • IsaacGoGo

    SSC Eights!

    Points: 944

    From the Author: My apologies for the Transact-SQL formating. The code examples work fine - they just look a little strange.

  • jcool

    SSC Eights!

    Points: 863

    quote:


    Information Schema Views were introduced in Microsoft SQL Server 2000


    No, no, no, INFORMATION_SCHEMA views are hidden in SQL 2000, but were clearly browsable with Enterprise Manager back in SQL 7. INFORMATION_SCHEMA is supposed to be some sort of a standard for accessing database schema. Now it is pretty hard getting the names of INFORMATION_SCHEMA views. And if you look at their sources you can find some strange ways Microsoft uses system tables. Looking at view sources you can clearly see things that are not implemented or implemented differently in SQL Server.

  • IsaacGoGo

    SSC Eights!

    Points: 944

    I'm sure with Yukon we'll learn if this (Information_Schema views) was an idea that will die on the vine. In the meantime, Books Online indicates that this is the preferred method. We'll see:

    "Information Schema Views

    Microsoft® SQL Server™ 2000 provides two methods for obtaining meta data: system stored procedures or information schema views.

    Note To obtain meta data, use system stored procedures, system functions, or these system-supplied views only. Querying the system tables directly may not provide accurate information if system tables are changed in future releases.

    These views provide an internal, system table-independent view of the SQL Server meta data. Information schema views allow applications to work properly even though significant changes have been made to the system tables. The information schema views included in SQL Server conform to the SQL-92 Standard definition for the INFORMATION_SCHEMA.

    SQL Server supports a three-part naming convention when referring to the current server. The SQL-92 standard also supports a three-part naming convention. However, the names used in both naming conventions are different. These views are defined in a special schema named INFORMATION_SCHEMA, which is contained in each database. Each INFORMATION_SCHEMA view contains meta data for all data objects stored in that particular database. This table describes the relationships between the SQL Server names and the SQL-92-standard names.

    "

  • ckempste

    SSCoach

    Points: 17983

    Hi there

    Nice article, ive used similar code before to locate email columns etc when organisations change email address structures etc, all very handy indeed and damn site easier than sys tables 🙂

    Have a good one!

    Cheers

    Ck

    Chris Kempster

    http://www.chriskempster.com

    Author of "SQL Server 2k for the Oracle DBA"


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply