How do I script the creation of an existing database including its data?

  1. Right click on the database in MS SQL Management Studio
  2. Click Tasks > Generate Scripts
  3. Click Next until you get to the "Set Scripting Options" tab in the wizard
  4. Set the file name to an appropriate path and file name for the completed script
  5. Click Advanced
  6. Scroll down to "Types of data to script" and change from schema only to Schema and data
  7. Click OK
  8. Click Next until your script is created