Hi
I would like to autmate the Generate Sql Script.
I am running NUnit testing with one of my projects and i am resetting the
database frequently
Now, whenever i make any change to my database, i need to regenerate the Sql
Script for this to work.
This proves quite monotonous.
Is there a way to automate this process?
What i'm doing now:
1) Right click DB, click all tasks -> Generate Sql Script
2) Click Show All, then Script all objects
3) Click options, check all the Table Scripting Options
4) Click Ok
5) Navigate to where i would like the script saved (defaults to My
Documents every time, i don't want it there)
6) Save and click yes to replace the existing script
So, this gets quite repetitive and annoying at times.
Any suggestions (other then just editing the Sql Script myself)
TIAGrant,
SQLDMO would be the obvious choice and Googling for it will show you several
links (eg http://www.dbazine.com/sql/sql-articles/larsen4).
If you want to use it directly, most objects have a Script method. If you
want a convenient wrapper around the SQLDMO code, there is an exe that you
could experiment with, eg this will script out the northwind database on
lon999:
"C:\Program Files\Microsoft SQL Server\MSSQL\Upgrade\scptxfr.exe" /s lon999
/I /d northwind /f c:\masterscriptfile.txt
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)|||http://www.karaszi.com/SQLServer/info_generate_script.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Grant Merwitz" <grant@.workshare.com> wrote in message news:eedutdS4FHA.3460@.TK2MSFTNGP12.phx.gbl...
> Hi
> I would like to autmate the Generate Sql Script.
> I am running NUnit testing with one of my projects and i am resetting the database frequently
> Now, whenever i make any change to my database, i need to regenerate the Sql Script for this to
> work.
> This proves quite monotonous.
> Is there a way to automate this process?
> What i'm doing now:
> 1) Right click DB, click all tasks -> Generate Sql Script
> 2) Click Show All, then Script all objects
> 3) Click options, check all the Table Scripting Options
> 4) Click Ok
> 5) Navigate to where i would like the script saved (defaults to My Documents every time, i
> don't want it there)
> 6) Save and click yes to replace the existing script
> So, this gets quite repetitive and annoying at times.
> Any suggestions (other then just editing the Sql Script myself)
> TIA
>|||Thanks Tibor and Paul for both your answers
I ended up using "scptxfr.exe" as it was so simple
Thanks Again
"Grant Merwitz" <grant@.workshare.com> wrote in message
news:eedutdS4FHA.3460@.TK2MSFTNGP12.phx.gbl...
> Hi
> I would like to autmate the Generate Sql Script.
> I am running NUnit testing with one of my projects and i am resetting the
> database frequently
> Now, whenever i make any change to my database, i need to regenerate the
> Sql Script for this to work.
> This proves quite monotonous.
> Is there a way to automate this process?
> What i'm doing now:
> 1) Right click DB, click all tasks -> Generate Sql Script
> 2) Click Show All, then Script all objects
> 3) Click options, check all the Table Scripting Options
> 4) Click Ok
> 5) Navigate to where i would like the script saved (defaults to My
> Documents every time, i don't want it there)
> 6) Save and click yes to replace the existing script
> So, this gets quite repetitive and annoying at times.
> Any suggestions (other then just editing the Sql Script myself)
> TIA
>
No comments:
Post a Comment