drop and create objects?
davehants
Posts: 3
I'm using redgate source control to save my database objects - stored procedures etc. - into my source control working folder to commit to our source control server.
When a stored procedure object is saved it appears in my working folder as an sql script starting with "....create procedure...".
Is there a way redgate source control can create that script starting with "....if exists... drop procedure.... create procedure..." ?
Any help or tips appreciated.
Rgds, Dave.
When a stored procedure object is saved it appears in my working folder as an sql script starting with "....create procedure...".
Is there a way redgate source control can create that script starting with "....if exists... drop procedure.... create procedure..." ?
Any help or tips appreciated.
Rgds, Dave.
Comments
Unfortunately there's no option to save the scripts as you describe.
The reason for this is because we don't ever intend the scripts to be run manually. Instead, they are there to represent a state of the database at any given time. To execute the scripts against another database, you'd actually use a tool such as SQL Compare to deploy the database. This works by comparing a model of your database represented by the scripts against the target and building a migration script to move from one state to another.
SQL Compare does offer an option to use drop and create instead of alter in the deployment scripts it generates, but that won't affect the ones you have held in your repository by SQL Source Control.
Redgate Software
Rgds, Dave.