TSQL to add an index

  • I need to modify an existing table, to change a field into an index field. I know how to do it through Enterprise Manager. Is there a way to do this through script?

    Thanks...Nali

  • In it's most basic format:

    create index MyNewIndex on MyTable(MyColumn)

    If you want it to be clustered:

    create clustered index MyClusteredIndex on MyTable(MyColumn)

    if you want it unique:

    create unique index MyUniqueIndex on MyTable(MyColumn)

    If you need any more info then BOL is your friend.

     

    S

Viewing 2 posts - 1 through 1 (of 1 total)

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