The following instructions demonstrate how to script your database into MD3 compatible SQL files
You don't need to do each of these steps unless you want that object under MD3 control.
  1. Script your tables.
  2. You can do this with the native table scripter in SSMS.
  3. follow the instructions in Tables\_readme.txt
  4. Script your Primary Keys
  5. find a pristine copy of your database and install the MD3 objects
  6. EXEC MD3.RepopulatePrimaryKeys --this will repopulate the MD3.PrimaryKeys table
  7. EXEC MD3.ScriptPrimaryKeys --produces PRINT statements to script out all PKs. Save the output to the PrimaryKeys folder
  8. An example file is found in the PrimaryKeys folder
  9. Script your Indexes
  10. find a pristine copy of your database and install the MD3 objects
  11. EXEC MD3.RepopulateIndexes --this will repopulate the MD3.Indexes table
  12. EXEC MD3.ScriptIndexes --produces PRINT statements to script out all Indexes. Save the output to the Indexes folder
  13. An example file is found in the Indexes folder
  14. Script your Foreign Keys
  15. find a pristine copy of your database and install the MD3 objects
  16. EXEC MD3.RepopulateForeignKeys --this will repopulate the MD3.ForeignKeys table
  17. EXEC MD3.ScriptForeignKeys --produces PRINT statements to script out all FKs. Save the output to the ForeignKeys folder
  18. An example file is found in the ForeignKeys folder
  19. Script your Check Constraints
  20. find a pristine copy of your database and install the MD3 objects
  21. EXEC MD3.RepopulateCheckConstraints --this will repopulate the MD3.CheckConstraints table
  22. EXEC MD3.ScriptCheckConstraints --produces PRINT statements to script out all check constraints. Save the output to the CheckConstraints folder
  23. An example file is found in the CheckConstraints folder
  24. Script your Defaults
  25. find a pristine copy of your database and install the MD3 objects
  26. EXEC MD3.RepopulateDefaultConstraints --this will repopulate the MD3.DefaultConstraints table
  27. EXEC MD3.ScriptDefaultConstraints --produces PRINT statements to script out all default constraints. Save the output to the DefaultConstraints folder
  28. An example file is found in the DefaultConstraints folder
  29. You can then choose to script your Triggers, schemas, filegroups, partition functions/schemes, users, etc and place them in the correct folders.

Last edited Dec 9, 2013 at 8:50 PM by dwentzel, version 2