I'm developing an application that connects to a SQL database which I am managing with SQL Management Studio. With each version of my app that I save in source control I want to also save a copy of the database schema that worked with that version. It seems that saving a SQL script to generate the database would be the best way to save this information, but what is the best way to do that? When I right click on my database in Managment Studio it appears that there are two options that may work "Tasks->Generate Scripts" and "Script Database As". What is the difference between these? Which should I use?
Script Database As only creates a script for creating the Database. If you use Generate Scripts it will start a wizard where you can choose to include all the database objects (tables, stored procedures, etc...). Always save the script to source control.