Take the 2-minute tour ×
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. It's 100% free, no registration required.

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
3  
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
1  
@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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.