Copying Tables structure from SQL 2000 to Local database.

  • Dear Friends,

    I have created my own DB which included a table named "Tables_Information". In this table i have created 8 columns which includes, Seq No, Module Name, Table Name, Table Desciption, Table Fields, Fields type, primary key as boolean, Foreign key as boolean.

    I want to copy all these information from SQL 2000 DB to my local table fields. Any method / procedure to fulfill this requirement???


    Raza Usmani

    Software Engineer

  • Is your local database that includes the new table in SQL 2005 or SQL 2000? Since you posted in the Integration Services forum, I could assume that it's in SQL 2005 and recommend that you use the Import Wizard in Management Studio.


  • Both Databases are on the same Server which is SQL 2000. Somehow i have managed to collect almost all data but unable to get foreign keys information.



  • You can find that in the sysforeignkeys system table. Here's a query that will list foreign key info for the tables in a database:

    select as 'Table', as 'Foreign_Key_Constraint', as 'Referenced_Table'

    from (select distinct constid, fkeyid, rkeyid from sysforeignkeys) as FK

    join sysobjects c on = FK.constid

    join sysobjects t on = FK.fkeyid

    join sysobjects rt on = FK.rkeyid

    order by 1,2,3


Viewing 4 posts - 1 through 3 (of 3 total)

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