in the same instance, i have a database1 and would like to export a part of the database1 and import in the database2 . i used the sql management studio tool to do this. but when the database2 created, the tables were in but not the indexes, constraints..etc.. do you know why ..? i may be miss something in the procedure. thks for your help.
What method did you use to do the import from SSMS? Did you use the Tasks -> Generate Scripts, method? If so, in the "Choose Script Options" dialog of the wizard Generate Scripts wizard, you have options for scripting indexes, constraints, triggers and just about everything else.
thank you for your reply. you mean that we must generate scripts for creating indexex first then after creating the new database we execute the creating indexes scripts... you don't have the method to do all of this together...? Thanks.
An index cannot exist in the absence of the table on which the index is built. So what Microsoft has done is to allow you the option of scripting (or not scripting) dependent objects (such as indexes) when you script objects such as tables.
It would be much more clearer if you experiment with the Generate Scripts wizard than when I explain it.
What method did you use to script the database objects?