Search code examples
sql-serverindexingcreate-table

Is there a built-in tool to generate "create table with index" script in SQL Server 2012?


I'd like to re-create an empty table based on existing one in my SQL Server 2012, the table is optimized with lot of indices, however I can't find any options for re-building those indices. The menu option Script Table as --> DROP And CREATE To will only create table structure itself.

Is there a way to solve my problem ? It's hard for me to build those indices manually.

enter image description here


Solution

  • along with Table Structure want Indexes

    Then

    GO TO ->

    SQLSERVER --> Tools --> Options
    -->
    SQL Server Object Explorer-->Scripting/Script Indexes 
    

    OR

    GO TO -- > Generate Scripts --> It will give Table Script with Indexes

    -- set to "True"