Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I have two tables that have identical constraints, datatypes and primary keys is there a way to 'import' the index from one table to another if they're on the same server, but in separate databases?

share|improve this question
99% sure you need to script indexes out then run the scripts on the new table. – JNK Feb 7 '13 at 19:07
I figured so, just checking. Thanks. – wootscootinboogie Feb 7 '13 at 19:09
@JNK: add another 1%. One might configure replication between the two databases and set the first one to send DDL changes to the second, but it's not really a nice solution :-). You could use a db compare tool to have the script generated for you. – Marian Feb 7 '13 at 20:55
up vote 3 down vote accepted

The only option will be to script out the index and create it on the new table in the other database.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.