views:

319

answers:

2

I've been looking at the SqlPubWiz.exe command to write a batch file so that I can keep my script up to date in my source control. But what I need is for the command line tool to allow me to pick specific tables to include (and that I can exclude others). I think SqlPubWiz.exe won't do that for me (let me know if I'm wrong) but if someone can point me to another tool that can do it, that's what I'm looking for.

+2  A: 

There are several commercial tools out there that can create database scripts, e.g.

Here's an article showing off a free tool - however, it will only script ALL objects from your database: Eric Moreau's blog.

If you want to "roll your own", have a look at the Server Management Objects (SMO) - those allow you to inspect your database and create scripts from them.

See info here, here or here.

Marc

marc_s
A: 

Try DBSourceTools. http://dbsourcetools.codeplex.com
Its open source, and specifically designed to script databases - tables, views, procs to disk.
It also allows you to select which tables, views, db-objects to script.

blorkfish