SQL Server 2008 automated database drop, create and fill

Posted by lox on Stack Overflow See other posts from Stack Overflow or by lox
Published on 2009-08-31T12:26:26Z Indexed on 2010/04/01 11:53 UTC
Read the original article Hit count: 314

Filed under:
|
|
|

For the database in my project I have a drop/create script for the database, a script for creating tables and SPs and an Access 2003 .mdb file with some exported values.

To set up the database from scratch I can use my SQL management studio to first run one script, then the other and lastly manually run the sort of tedious import task.

But I would like to do this as automated as possible. Hopefully something like putting the three files in a folder along with a fourth script to execute. Looking something like:

run script "dropcreate.sql"
run script "createtables.sql"
import "values.mdb"

How is this done? I hope to avoid using SSIS and the like. The tricky this is of course the import of data, where I can't seem to find a simple way. It is also important that the files a left as they are and not embedded into anything.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql