There may be few scenario where we want to mimic our (production)
database structure in some other local environment so that development team can
proceed with their integration or development activity.
We defiantly do not want to share our data or
information for security reason.
However, there could be a possible reason that we might
be storing some configuration data that development team might be interested in
it.
For an example Employee Designation or Rank, various
type of leaves.
Please note: For security reason few of the
images are been altered to hide the server and credential details
- Go and open SQL Management Studio.
- Connect to your Database Server.
- Expand the list of Databases from Object explorer.
- Right click the desired Database and navigate to Tasks -> Generate Scripts…
- The above action will launch the Generate and Publish Scripts wizards. Proceed with next button.
- Select the option for Script the entire database and all database objects and proceed with Next button.
- Choose output type to Save scripts to a specific location.
- Choose option to Save to file. Enter manually the file name with extension .sql as depicted in below image. This is the location where generated script will be saved.
- Proceed further by clicking on the next button.
- Review your selections and click on the next button to proceed.
- You should see the generation of scripts began and it may take a while depending upon the complexity of database metadata.
- Click on Finish button and locate the file on the destination folder choose in one of the above steps.