How Can I Get a List of the Fields in a Table?

  • Saw the replies about INFORMATION_SCHEMA and went looking for the views.  Couldn't find them anywhere!  Then went and had a look in a little test database on my computer (set up with MSDE), and lo, they were in this database.

    Aha! if I can't find them in the main database their must be a script for creating them.

    Wrong!  After a fruitless search of BOL and the web for same, eventually came across this statement from Microsoft ... see http://support.microsoft.com/default.aspx?scid=kb;en-us;294350

    If you try to upgrade user databases from SQL Server 7.0 to SQL Server 2000 by using either the Copy Database Wizard or the sp_attach_db stored procedure, the user databases in SQL Server 2000 will not contain the INFORMATION_SCHEMA views. The same applies if you try to upgrade your existing SQL Server 7.0 default instance to SQL Server 2000 using SQL Server 2000 Setup. This behavior is by design.

    Grrrrr!

    One method I've used to get list of fields is to generate a script in Enterprise Manager, copy to Excel, and then use "Text to Columns" to break up and manipulate as necessary.

Viewing post 16 (of 15 total)

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