views:

884

answers:

2

Hi there,

I have two database with same structures, but one of them is missing INDEXES (i think i've missed out), i mean the table didn't have any INDEXES yet.

I was plan to generate CREATE INDEX for the database which have indexes but can't found any method available in Management Studio, yes we can generate script for tables, view, etc, but i was only need to script the INDEXES not anything else.

I know if we generate a script using IF EXIST can be solution, so if object already exist it doesn't recreate, but again for simplicity shake, i just want script the INDEXES.

Thanks

A: 
Anton Gogolev
yes i know that, infact i already use it... it generate all statement which included table, view(if any), stored procedure (if any), indexes, etc... what i need was only generate indexes
Dels
It provides a way to choose object types to script.
Anton Gogolev
yes but it need to create tables script before indexes, no indexes only script
Dels
A: 

Not specific to just your need for Indexes, but a good way to keep multiple DBs in sync structure wise is to use a tool such as Redgate's SQL Compare, or AdeptSQL Diff, or similar. These will show you the differences between 2 databases and generate and even run the required scripts to get them into sync. Much easier than trying to do this manually.

schooner
yeah but it's not free, mean another cost, i need this only for a fix (which is my mistake not creating INDEX in second dataase)
Dels