Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Programatically open and run a script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-11-16 : 06:55:03
Cam writes "I am working on a project where I am writing many scripts to handle some data migration tasks from a dev environment to a clean copy of the production environment for iterative testing.

The upshot of this is that I need to run the same set of scripts over and over (and over...) and I'm looking for a more elegant solution. I'm trying to manage the scripts as discreet .sql files for purposes of source control and - well - disctinctness.

In my 'perfect world' scenario - I'd like to create a T-SQL script which would:
- read records from a table which contained UNC paths to the individual scripts
- for each record - open and run the script described at the UNC

Can I get there from here?

Thx for any help,

Cam"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-11-16 : 06:56:10
Take a look at these:

http://weblogs.sqlteam.com/robv/articles/4099.aspx
http://weblogs.sqlteam.com/robv/articles/4102.aspx

You wouldn't need to store the script file names in the database, it's easier to store them in a plain text file, or put them into specific directories and use the for command to enumerate those directories.
Go to Top of Page
   

- Advertisement -