Wednesday, March 7, 2012

Generate Scripts...

From SQL Server Management Studio, I can right click a database, select
Generate Scripts.. and then navigate through a wizard to script my database
objects.
Is it possible to schedule such an activity? I'd like to set up a schedule
to script all my database objects on a regular basis
tia
Terry Holland
Well, you could grab the script it runs using Profiler, and then create a
job that runs the same script.
Or you could just archive backups of the database at the same interval,
assuming size / disk space is not an issue.
Aaron Bertrand
SQL Server MVP
http://www.sqlblog.com/
http://www.aspfaq.com/5006
"Terry Holland" <MSDNNospam248@.nospam.nospam> wrote in message
news:BBDE32F9-FC8F-48CE-9072-AF0BF23F23A0@.microsoft.com...
> From SQL Server Management Studio, I can right click a database, select
> Generate Scripts.. and then navigate through a wizard to script my
> database
> objects.
> Is it possible to schedule such an activity? I'd like to set up a
> schedule
> to script all my database objects on a regular basis
> tia
> Terry Holland
|||Hello,
You will have to use SQL DMO object using sp_OA* extended stored procedures.
Take a look into below URL for details.
http://www.databasejournal.com/features/mssql/article.php/2205291
Thanks
Hari
"Terry Holland" <MSDNNospam248@.nospam.nospam> wrote in message
news:BBDE32F9-FC8F-48CE-9072-AF0BF23F23A0@.microsoft.com...
> From SQL Server Management Studio, I can right click a database, select
> Generate Scripts.. and then navigate through a wizard to script my
> database
> objects.
> Is it possible to schedule such an activity? I'd like to set up a
> schedule
> to script all my database objects on a regular basis
> tia
> Terry Holland
|||You could also have a look here: http://www.elsasoft.org/tools.htm
there you will find a console app that will generate scripts for all
objects in any 2000 or 2005 database. it would be a simple matter to
schedule it to run every day using either Agent or a scheduled task in
windows.
On Apr 4, 6:31 am, "Hari Prasad" <hari_prasa...@.hotmail.com> wrote:[vbcol=seagreen]
> Hello,
> You will have to use SQL DMO object using sp_OA* extended stored procedures.
> Take a look into below URL for details.
> http://www.databasejournal.com/features/mssql/article.php/2205291
> Thanks
> Hari
> "Terry Holland" <MSDNNospam...@.nospam.nospam> wrote in message
> news:BBDE32F9-FC8F-48CE-9072-AF0BF23F23A0@.microsoft.com...
>
>
|||Aaron Bertrand [SQL Server MVP] (ten.xoc@.dnartreb.noraa) writes:
> Well, you could grab the script it runs using Profiler, and then create a
> job that runs the same script.
I don't think that would work, since there may be different objects from
day to day.
I would guess the best bet is to see what Integration Services can do. The
script wizard does not use SSIS, but the Copy Database Wizard do, and it
also scripts the database. (Nevermind that CDW is quite flaky.)
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

No comments:

Post a Comment