Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Kansas City, MO
    Posts
    1

    Unanswered: Newbie SQL db question

    Hello all,
    I'm brand new around here. I work with an extremely large SQL database (several hundred tables with several hundred thousand records in each table). I had no part in setting this db up, but am responsible for various integrity issues. One problem i have is not knowing exactly what type of data each column will accept without trial & error.

    My question: Is there a way i can get table info on a specific table with a simple SQL statement (in Query Analyzer) (column name, data type, num of characters etc)? I use SQL server 7, but do not have ready access to Enterprise Manager.

    Thank you for your patience

  2. #2
    Join Date
    Oct 2002
    Posts
    369

    Re: Newbie SQL db question

    Originally posted by questlove
    Hello all,
    I'm brand new around here. I work with an extremely large SQL database (several hundred tables with several hundred thousand records in each table). I had no part in setting this db up, but am responsible for various integrity issues. One problem i have is not knowing exactly what type of data each column will accept without trial & error.

    My question: Is there a way i can get table info on a specific table with a simple SQL statement (in Query Analyzer) (column name, data type, num of characters etc)? I use SQL server 7, but do not have ready access to Enterprise Manager.

    Thank you for your patience
    -- Some stored procedures you should find useful: (run in QA)

    -- System Procedures:
    exec sp_helpdb
    -- Returns DBs on the current Server

    exec sp_help
    -- Returns objects (tables views, etc.), types, etc. in the current DB

    -- Catalog Procedures: (some have several parameters, this should get you started)
    Use Pubs
    Go

    exec sp_tables
    -- Returns tables in the current DB

    exec sp_tables @table_name = 'Authors'
    -- Returns table info only on table Authors in the current DB

    exec sp_columns @table_name = 'Authors'
    -- Returns column info for the table designated in the current DB

    exec sp_fkeys @pktable_name = 'Authors'
    -- Returns foreign key info for the table designated in the current DB

    exec sp_pkeys @table_name = 'Authors'
    -- Returns primary key info for the table designated in the current DB

    exec sp_helpindex @objname = 'Authors'
    -- (actually a system proc), Returns index info for the table designated in the current DB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •