You are here: Home / Blog / posts / Programming Magic / Create scripts for source control

Create scripts for source control

by admin published Jan 28, 2014 02:31 PM, last modified Jan 28, 2014 02:31 PM
When creating SQL scripts for source control, date time stamps make it difficult to see exactly what changed between versions.

Steps to create scripts to to create your database

1) Right click your database and choose Tasks->Generate Scripts...

Generate Scripts Menu

2) On the Choose Objects step, don't choose "Script entire database and all database objects" as this contains roles and other things we don't want. Instead choose "Select specific database objects". typically Tables, Views, and stored procedures.

Choose Objects

3) Choose where to save the script. Typically the query window is picked so it can be copied and pasted into a script file for source control.

4) Click on the Advanced button.

Advanced Button

5) Typically most values are not changed. To prevent the date time stamp, set "Include Descriptive Headers" to False

No Headers Choice

6) Press OK on the Advanced Scripting Options screen.

7) Press Next >, Next>, Finish