Results 1 to 6 of 6

Thread: index only ddl

  1. #1
    Join Date
    Dec 2007
    Posts
    13

    index only ddl

    Hi,

    I am working with SQL Server 2005 Express. What I would like to do is extract only the indexes from a database and apply them to another database. Looking at the Utility to create the SQL scripts, it does not give the ability to generate just the index ddl (Primary Key, Foreign Key, indexes, etc).

    Is there a way to do this without including the tables in the DDL?

    Thanks

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    You can script all indexes in a table in ssms.

  3. #3
    Join Date
    Dec 2007
    Posts
    13
    thank you for the response,

    I have tried to use ssms, but to get the index DDL you have to create the table DDL. I was hoping to find a way to generate just the index ddl for all tables in a given database.

  4. #4
    Join Date
    Sep 2002
    Posts
    5,938
    Click on indexes under a table in ssms and go to object explorer details panel, you'll see all indexes in the table. Highlight all of them, right click then choose script indexes as -> create to -> where you want to put the script.

  5. #5
    Join Date
    Dec 2007
    Posts
    13
    Is there a way to multi select all tables in a database and have the ssms generate just the index DDL - not the table DDL?

  6. #6
    Join Date
    Sep 2002
    Posts
    5,938
    Not as I know of.

Posting Permissions

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