index

  • In my table i have a column 'DescriptionID' which is a Guid (NOT NULL)

    Ive created an index on this column in enterprise manager (non unique) and saved the table

    When I generate a create script for this table, the index isnt defined anywhere

    am I missing something ?

  • No, just that the tools don't usually script indexes when you ask for the table to be scripted. It can be a separate option, depending how you did the script.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • ah, ok, so Id have to script the entire database and select the 'include index' option. Seems a bit odd that I cant script indexes on individual tables

  • You certainly can script individual indexes. From Object Explorer expand out the table, right click on the index (under the table -> indexes) and select script.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • There is also an option in Tools->Options->SQL Server Object Explorer->Scripting->Table and view options->Script indexes

    Set the value to "True" and then try scripting the table, you should get the script of the indexes


    Kingston Dhasian

    How to post data/code on a forum to get the best help - Jeff Moden
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

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

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