Re: Scripting a SQL database

From: Robbe Morris [C# MVP] (info_at_turnkeytools.com)
Date: 02/20/05


Date: Sun, 20 Feb 2005 09:56:18 -0500

Virtually everything SQL Server Enterprise Manager does can be
do via script because that is in large part what EM uses "at some
point" in the process (either directly or indirectly via DMO).

To run the generated script in ASP, you literally just
read the script file in as a string and pass it to the ADO
connection object's .Execute method. It is that simple.

You can also create a DTS (Data Transformation Package)
utilizing the Import / Export Wizard. Then, use ASP to run
the package. This, in my opinion, may be a better option than
scripts from a support and simplicity standpoint. My guess is
that you'll want to select the "copy database objects and data"
when you get to the part in the wizard where it asks you what
you want to do. At the end, you'll be given an option as
to how you want to store the package. Select the option to
store it in SQL Server. What is nice about this option is that
if you make a change to your database, you just rerun the
wizard (after deleting the current package) and you are all set.
No need to move files around or deploy them.

Using the wizard is pretty straight forward. Calling the stored
package in SQL Server isn't. Here is a VBScript (which
is really the underlying language in ASP) to run a DTS
package. It also includes other code for ftp'ing data that
you probably don't need.

http://www.eggheadcafe.com/articles/20030923.asp

I'm upgrading our servers today. So, if the link doesn't come
up, check again in a few hours.

These other SQL Server Flash Video presentations for database
management may also come in handy:

http://www.eggheadcafe.com/videodemo/

-- 
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/forumvbcode/post10017013.aspx
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
"Roland Hall" <nobody@nowhere> wrote in message 
news:e6iVeUzFFHA.2180@TK2MSFTNGP10.phx.gbl...
> "Robbe Morris [C# MVP]" <info@turnkeytools.com> wrote in message
> news:%23tAuoytFFHA.3840@tk2msftngp13.phx.gbl...
> : Yes and yes.
>
> Thanks for responding...
>
> I only asked one closed-end question.  Can I get some pointers on getting
> this done?  You might want to review my response to the other responder.
> Examples would be great but research material and knowing what to look for
> would be fine too.
>
> :
> : You just use the connection.execute mysqlscriptstring
> :
> : You've just got to connect to the database with an account
> : that has enough priviledge to run your script.
>
> How are the scripts that Enterprise Manager can create from an existing
> database used to recreate this structure on a different server?
>
> Roland
>
> 


Relevant Pages

  • Re: Cannot Open SQL Server Table in Access.ADP File.
    ... Other possiblities would be that you didn't refresh the database window ... I have an SQL Server 2005 database which functions properly with my ... the Generate Script Wizard to recreate the SQL Server Database. ... Then, If I attempt to open another table, it opens. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: SQL Security
    ... except I'm having problems making it work in a script. ... ;Set properties of DB objects and open connection to database ... > from Books Online (within the SQL Server program group): ... > communicate with SQL Server. ...
    (microsoft.public.sqlserver.server)
  • RE: Project Server 2003
    ... when I got to the run script step, I ran the script from the copied database ... I was also wondering about the create database ... For example, type Project Server, and then click OK. ... In the left pane of SQL Server Management Studio, expand Databases, ...
    (microsoft.public.windows.server.sbs)
  • Re: Database Access
    ... Do you create the group in SQL Server on the NT Domain? ... >> from a client script to ... > the database server would not be possible from client machines. ... You will want the sqloledb connection string. ...
    (microsoft.public.scripting.jscript)
  • Re: Scripting a SQL database
    ... Virtually everything SQL Server Enterprise Manager does can be ... To run the generated script in ASP, ... You can also create a DTS (Data Transformation Package) ... that you'll want to select the "copy database objects and data" ...
    (microsoft.public.sqlserver.server)