I receive a complete updated database every night in a SQL backup file.
Each morning a script runs to restores the DB to our SQL server, sets security on the DB and creates a number of views that we’ve developed.
The systems works well except when someone creates or modifies a view they need to call me and I:
Login to the SQL server’s Management Studio,
right click on the database,
select “Generate Scripts” from the “Tasks” menu,
and run through the wizard to create a script to create my views.
What I’d like to have happen is for the morning script to overwrite the script that creates the views prior to restoring the database so that if any changes were made to the views, they would be recreated when the database was restored.
Is there a way to script the manual procedure I use to generate the views creation script?